This assumes you are now connected to the server via SSH.
sudo -sEnter root mode for admin accessgroupadd devgroupCreate new group to be later granted access to /var/www/html
useradd -G root,devgroup masterdevCreate new root user. Also add to the devgrouppasswd masterdevChange password for the new root user- At this point, you'll need to input your new root user's new password
Next, we'll need to set PasswordAuthentication to On. By default, passwords cannot be used on SSH (Off), so you initially need to use the pem or ppk files. However, since we now have created our new root user, we can change this and set it to "On".
vi /etc/ssh/sshd_configEdit SSH config file- Make sure this is set:
PasswordAuthentication yes service sshd restart
vi /etc/sudoersEdit the sudoers file- Add masterdev user after the root's line
root ALL=(ALL) ALL
masterdev ALL=NOPASSWD: ALL
- Since the sudoer file is read-only, you may need to save your changes using
:wq!.
yum update -yUpdate linux packagesyum -y install httpd24Install webserverchkconfig httpd onSetup serviceyum -y install php55 php55-devel php55-common php55-cli php55-pecl-apc php55-pdo php55-mysql php55-xml php55-gd php55-mbstring php-pear php55-mysqlnd php55-mcryptInstall php and the usual extensions.
- Apache Configuration
vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
- PHP Configuration
vi /etc/php.ini
error_log = /var/log/php-error.log
date.timezone = "UTC"
usermod -a -G devgroup apacheAdd apache to dev group- Give the devgroup access to /var/www/html
chown -R root:devgroup /var/www/html
chmod -R 775 /var/www/html
service httpd start
- If you will be using Amazon RDS or any separate database server, skip the whole MySQL Section. This is only required when you want to use a "localhost" MySQL on your server.
wget -O mysql.rpm http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm/from/http://repo.mysql.com/yum -y localinstall mysql.rpmyum -y install mysql-community-serverservice mysqld startchkconfig mysqld onmysql_secure_installation- MySQL will ask for root password. By default, its blank. Press enter.
- MySQL will ask to set root password, answer
Y. - Input the new root password
- MySQL will ask to remove anonymous users, answer
Y. - MySQL will ask to disallow root login remotely, answer
Y. - MySQL will ask to remove test database, answer
Y. - MySQL will ask to reload privileges, answer
Y. mysql -u root -pTest Root Login to MySQL Console- At this point you will need to enter your password
- If the console prefix changed to
mysql>, it was successful - Type
exitto go back to Linux command line
cd /var/www/htmlwget -O pma.zip http://nchc.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.3.3/phpMyAdmin-4.3.3-english.zipunzip pma.zipmv phpMyAdmin-4.3.3-english dbasudo rm pma.zip- phpMyAdmin now accessible on
http://your_server/dba
useradd -d /var/www/html -G devgroup -M devAdd dev user, with home pointing to web directory, and add to the devgroup.passwd devChange password for the dev user- At this point, you'll need to input the dev user's new password
- Use the username and password of the Dev User you just created
- Use SFTP connection. FTP only will not work.
Thanks for this. It seems like in step 2 (b) for nginx, the proper 3rd command for "setup service" should be:
chkconfig nginx oninstead ofchkconfig httpd on