Tampilkan postingan dengan label LAMP. Tampilkan semua postingan
Tampilkan postingan dengan label LAMP. Tampilkan semua postingan

Sabtu, 25 Oktober 2014

Give Apache Own User

CENTOS
--------------------------------------------------------------------------------------
Add a user (who isn’t root)
Add a new user to the wheel and apache groups. The wheel group gives root/sudo access. The apache group allows both user and apache to write to your website files. The -G tells useradd we want to add to multiple groups. Sam is the username in this example.
useradd -G wheel,apache us3r
passwd us3r
Set directory and file permissions
Make apache the owner of /var/www. The -R makes the ownership changes recursive (apply to all files and directories within /var/www.
The syntax here is user:group. All users automatically have a group of the same name (e.g. user sam has a group called sam).
chown -R apache:apache /var/www
Change the permissions to give the owner (apache) and members of the apache group write permission (775).
find /var/www/ -type f -exec chmod 664 {} \;
find /var/www/ -type d -exec chmod 775 {} \;
Now resecure /var/www by giving it back to root or the user you created earlier.
chown root:root /var/www
View/confirm directory ownership/permissions with the ls -lcommand.
ls -l /var
ls -l /var/www
If you prefer editing long config files via S/FTP in a desktop text editor like Coda, take ownership of the following.
chown sam:sam /etc/php.ini 
chown sam:sam /etc/my.cnf 
chown -R sam:sam /etc/php.d
chown -R sam:sam /etc/httpd
Give your new user root privileges
Start by using a special text editor visudo by issuing the following command.
visduo
Enable the wheel group by uncommenting the following line like so.
## Allows people in group wheel to run all commands
%wheel        ALL=(ALL)       ALL
Alternatively, uncomment the next line to enable the wheel group and allow these user to become root without having to renenter their password.
## Same thing without a password
%wheel        ALL=(ALL)       NOPASSWD: ALL
Now logout of your SSH session, then test logging in as the new user.
logout
ssh sam@YOUR_IP_HERE
Test that the new user can become root.
sudo su -
The # should change to & and the user should show root@YOUR_HOSTNAME. Now logout of root to get back to your user.
logout
For reference, you can also execute single line commands as root by prefixing with sudo e.g.
sudo visudo

source http://whatsamknows.tumblr.com/post/40245741052/centos-lamp-permissions


Rabu, 02 Oktober 2013

LAMP on Centos

Keep House Clean (TIDAK HARUS DILAKUKAN)
service httpd stop
yum remove php php-*
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
ls -1 /etc/yum.repos.d/epel* /etc/yum.repos.d/webtatic.repo
/etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel-testing.repo
/etc/yum.repos.d/webtatic.repo
vi /etc/yum.repos.d/webtatic.repo
[webtatic]
name=Webtatic Repository $releasever - $basearch
#baseurl=http://repo.webtatic.com/yum/centos/5/$basearch/
mirrorlist=http://repo.webtatic.com/yum/centos/5/$basearch/mirrorlist
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy
 
=====================start here ============================
APACHE
yum install httpd
service httpd restart
PHP5
yum install php php-mysql
service httpd restart
untuk mencoba silahkan ketikkan
echo "<?php phpinfo();?>" >> /var/www/html/info.php
untuk mencari modul gunakan perintah
yum search php-
MYSQL
yum install mysql-server
service mysqld start
/usr/bin/mysql_secure_installation
MAKE APACHE AND MYSQL AUTORUN
chkconfig httpd on
chkconfig mysqld on
JSON
yum update
yum install php-pear php-devel gcc make
pecl install json
echo "extension=json.so" >> /etc/php.d/json.ini
echo "extension=php_curl.dll" >> /etc/php.ini
echo "extension=ffmpeg.so" >> /etc/php.ini
echo "extension=json.so" >> /etc/php.ini
service httpd restart
PHPMYADMIN
CentOS/RHEL 6, 32 Bit (i386):
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
CentOS/RHEL 6, 64 Bit x86_64):
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
CentOS/RHEL 5, 32 Bit (i386):
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
CentOS/RHEL 5, 64 Bit (x86_64):
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
step 2
yum install phpMyAdmin
Troubleshooting : » #2002 – Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) The server is not responding (or the local server’s socket is not correctly configured). ( This means your mysql server service is stopped , you must start the service “service mysql start”) » You don’t have permission to access /phpMyAdmin/ on this server. Open /etc/httpd/conf.d/phpMyAdmin.conf file and find the lines “Deny from All ” and comment those lines and restart httpd service

Tambahan
Reset root password
/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
mysql -u root
use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
flush privileges;
quit
/etc/init.d/mysqld start
mencoba hasil reset
mysql -u root -p mysql;
select host,user from user;
quit
/etc/init.d/mysqld start
chkconfig
sudo /sbin/chkconfig httpd on
sudo /sbin/chkconfig --list httpd
httpd           0:off        1:off  2:on    3:on    4:on    5:on    6:off
FIREWALL
sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT
sudo service iptables save
check firewall status
sudo netstat -plunt
source : http://www.rackspace.com/knowledge_center/article/centos-apache-and-php-install

LAMP and PHPMYADMIN on debian 6

CHANGE SSH PORT
vi /etc/ssh/sshd_config
/etc/init.d/ssh restart
UPDATE
apt-get update
APACHE 2
apt-get install apache2
PHP 5
apt-get install apache2 php5 libapache2-mod-php5 php-pear 'php5-suhosin
service apache2 restart
rm -fr /var/www/index.html
echo "<?php phpinfo();?>" >> /var/www/index.php
MYSQL
apt-get install mysql-server mysql-client php5-mysql
mysql_secure_installation
service apache2 restart
RESET ROOT PASSWORD
apt-get install phpmyadmin
/etc/init.d/apache2 restart


REMOTE MYSQL
vi /etc/mysql/my.cnf 
bind-address            = 127.0.0.1
diganti menjadi 
bind-address            = 0.0.0.0
service mysql restart
VSFTPD
apt-get install vsftpd
useradd bowongs0
passwd bowongs0
vi /etc/passwd


dont forget to remove samba
apt-get remove samba