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".
sudo vi /etc/ssh/sshd_configEdit SSH config file- Make sure this is set:
PasswordAuthentication yes sudo service sshd restart
sudo vi /etc/sudoersEdit the sudoers file- Add masterdev user after the root's line
root ALL=(ALL) ALL
masterdev ALL=NOPASSWD: ALL
sudo yum update -yUpdate linux packagessudo yum -y install httpd24Install webserversudo chkconfig httpd onCheck for config errorssudo service httpd startStart the webserversudo yum -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.sudo service httpd restartRestart the webserver
- Apache Configuration
sudo vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
- PHP Configuration
sudo vi /etc/php.ini
error_log = /var/log/php-error.log
date.timezone = "UTC"
- After configurations
sudo service httpd restart
sudo usermod -a -G devgroup apacheAdd apache to dev groupsudo service httpd restart
- 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.
sudo yum -y install mysql mysql-serverInstallsudo mysqladmin -u root password 'NEW_ROOT_PASSWORD'Setup root passwordsudo chkconfig mysqld onCheck if there are config errorssudo service mysqld startStart the mysql servicesudo mysql -u root -pLogin to MySQL via console- At this point you will need to enter your password
- After entering your password, the console supposedly changed to
mysql>. - At this point you can execute MySQL queries, not linux commands.
- Execute the following code to test running queries:
DROP DATABASE test;
DELETE FROM mysql.user WHERE user = '';
FLUSH PRIVILEGES;
- To exit the MySQL Console, you can type
exit, or pressCtrl+C.
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