• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System CentOS

How to Install Apache, MySQL, and PHP on CentOS 6

How VPS by How VPS
October 1, 2019
in CentOS
0
0
SHARES
22
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Introduction
  2. Prerequisites
  3. Step One: Install Apache
  4. Step Two: Install MySQL
  5. Step Three: Install PHP
  6. Want to contribute?


Introduction

LAMP is an acronym that stands for Linux, Apache, MySQL, and PHP. This software stack is the most popular open-source solution for the setup of web servers.

Since we have decided to use the CentOS 6 x64 distribution of Linux on a Vultr VPS, we will only introduce how to install the other components in this article.

Prerequisites

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.

Step One: Install Apache

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

Step Two: Install MySQL

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

Step Three: Install PHP

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.

yum info NameOfTheModule

Usually, you will need two modules: php-mcrypt and php-mbstring. Install them with the following commands:

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

That’s it. You have installed a LAMP stack onto your Vultr VPS.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

Install Polr on CentOS 8

Next Post

Install Plesk on CentOS 7

Next Post

Install Plesk on CentOS 7

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet