LAMP stack is the most powerful open source solution on the web. LAMP stands for Linux, Apache, Mysql and PHP. In this article we are going to Install these on CentOs 6. So We already have Linux running centOs. We will work on the next three in this article.
For installation you have to login on the terminal with root privileges. Otherwise you will need to use sudo with every command.
INSTALL APACHE
To install Apache type this command in terminal
sudo yum install httpd
sudo chmod 777 /var/www/html
sudo chkconfig httpd on
sudo service httpd start
You will now see a page running Apache like below. This page will be removed when you upload your index file in /var/www/html
INSTALL PHP
Now Install PHP with following command
sudo yum install php php-mysql
sudo yum install gd gd-devel php-gd php-xml
sudo service httpd restart
INSTALL MYSQL
Install MYSQL with following command
sudo yum install mysql-server
sudo chkconfig mysqld on
sudo service mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h li1256-197 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
As it says above let us now set a root MySQL password. Type the following command in terminal.
sudo /usr/bin/mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on...
.........
.........
Set root password? [Y/n] Y
New password: mypwd@123
Re-enter new password: mypwd@123
Remove anonymous users? [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
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!