In this article, we assume that you have set up a CentOS 6 x64 Vultr VPS from scratch and have logged in as root. Non-root users will need to use the sudo command.
sudo
To install and start Apache, open your SSH terminal and input the following commands:
yum -y install httpd service httpd start
Check if Apache is installed and running properly with:
service httpd status
Note: You cannot check if Apache is running properly by visiting the IP address of your Vultr VPS from your browser, as the firewall will block your visit by default.
You need to open port 80 to make your web server accessible:
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT /etc/rc.d/init.d/iptables save
To install and start MySQL, open your SSH terminal and input the following commands:
yum -y install mysql-server service mysqld start
On production servers, you should secure MySQL with the following command:
/usr/bin/mysql_secure_installation
The command prompt will ask for your current MySQL root password. Leave it blank by pressing ENTER.
Then, answer the command prompt as specified below:
Set root password? [Y/n] Y New password: YourDesiredPassword Re-enter new password: YourDesiredPassword Remove anonymous user? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y
To install PHP on your Vultr VPS, open your SSH terminal and input the following command:
yum -y install php php-mysql
Depending on the web applications that you intend on running, you may need to install some PHP modules to your server. You can check available modules by typing the following command:
yum search php-
To see more details about the modules that you are interested in, input the following command. Remember to replace NameOfTheModule with the name of the module that you pick from the screen.
NameOfTheModule
yum info NameOfTheModule
Usually, you will need two modules: php-mcrypt and php-mbstring. Install them with the following commands:
php-mcrypt
php-mbstring
yum -y install php-mcrypt.x86_64 yum -y install php-mbstring.x86_64
You can install other modules in the same fashion.
To get the stack functioning, you also need to set Apache and MySQL to run automatically when your VPS boots (PHP will run automatically with Apache):
chkconfig httpd on chkconfig mysqld on
Restart Apache web server to put all changes into effect:
service httpd restart
« Go back
Powered by Help Desk Software HESK, in partnership with SysAid Technologies