Install Apache server on Centos 6

To install Apache on your Centos 6

# yum install httpd

To run Apache automatically by default when the system boot/reboot

# chkconfig httpd on
or
# /sbin/chkconfig --levels 235 httpd on

To start Apache on your Centos 6

# service httpd start

To restart Apache on your Centos 6

# service httpd restart

To stop Apache on your Centos 6

# service httpd stop
Your Apache server should be running by now, you can check it with your web browser by going to http://yourserverip or http://yourdomain

Install MySQL server on Centos 6

MySQL is the world most popular open source database management system, it’s free yet powerful. MySQL is used to store database for many popular web applications such as WordPress, Drupal, PhpBB…

To install MySQL on your Centos 6

# yum install mysql-server

To run MySQL automatically by default when the system boot/reboot

# chkconfig mysqld on
or
# /sbin/chkconfig --levels 235 mysqld on

To start MySQL on your Centos 6

# service mysqld start

To restart MySQL on your Centos 6

# service mysqld restart

To stop MySQL on your Centos 6

# service mysqld stop

You can set password for root accounts and removes root accounts accessible from outside the localhost to improve MySQL security by running mysql_secure_installation.

 

# mysql_secure_installation

You will be asked to enter the current MySQL password which you don’t have yet, leave it blank. Then you will be asked to enter the new root password which you are going to set it with the password for root account in MySQL server. Type your MySQL root password twice. The next three questions you would want to answer “Y” for yes.

  • Remove anonymous users? [Y/n] Y
  • Disallow root login remotely? [Y/n] Y
  • Reload privilege tables now? [Y/n] Y
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

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!

Install PHP on Centos 6

PHP (PHP Hypertext Preprocessor) is a very widely used open source server side scripting language which also free to download and use. PHP can run on many platforms (Linux, Unix, Mac OS, Windows…) Many web CMS (content management systems) are written in PHP include WordPress, PHPbb, Joomla, Drupal, Moodle, even Facebook and Digg.

To install PHP and necessary PHP Modules on your Centos 6

# yum install php php-pear php-mysql php-gd php-mbstring
You can install more PhP Modules to your Dedicated Server to support more libraries and PHP applications.

To see what PHP Modules available for your system

# yum search php-
Here are some PHP Modules that available for my Centos 6

php-bcmath.i686 : A module for PHP applications for using the bcmath library
php-cli.i686 : Command-line interface for PHP
php-common.i686 : Common files for PHP
php-dba.i686 : A database abstraction layer module for PHP applications
php-devel.i686 : Files needed for building PHP extensions
php-embedded.i686 : PHP library for embedding in applications
php-enchant.i686 : Human Language and Character Encoding Support
php-fpm.i686 : PHP FastCGI Process Manager
php-gd.i686 : A module for PHP applications for using the gd graphics library
php-imap.i686 : A module for PHP applications that use IMAP
php-intl.i686 : Internationalization extension for PHP applications
php-ldap.i686 : A module for PHP applications that use LDAP
php-mbstring.i686 : A module for PHP applications which need multi-byte string handling
php-mysql.i686 : A module for PHP applications that use MySQL databases
php-odbc.i686 : A module for PHP applications that use ODBC databases
php-pdo.i686 : A database access abstraction module for PHP applications
php-pear.noarch : PHP Extension and Application Repository framework
php-pecl-apc.i686 : APC caches and optimizes PHP intermediate code
php-pecl-apc-devel.i686 : APC developer files (header)
php-pecl-memcache.i686 : Extension to work with the Memcached caching daemon
php-pgsql.i686 : A PostgreSQL database module for PHP
php-process.i686 : Modules for PHP script using system process interfaces
php-pspell.i686 : A module for PHP applications for using pspell interfaces
php-recode.i686 : A module for PHP applications for using the recode library
php-snmp.i686 : A module for PHP applications that query SNMP-managed devices
php-soap.i686 : A module for PHP applications that use the SOAP protocol
php-tidy.i686 : Standard PHP module provides tidy library support
php-xml.i686 : A module for PHP applications which use XML
php-xmlrpc.i686 : A module for PHP applications which use the XML-RPC protocol
php-zts.i686 : Thread-safe PHP interpreter for use with the Apache HTTP Server
To learn more about specific PHP Modules packages detail

# yum info module name
For example
# yum info php-xml

To add more PHP Modules to your server

# yum install module name
For example
# yum install php-xml
Remember to restart apache every time after making change to PHP for the changes to take effect on your CentOS Dedicated Server.
# service httpd restart
or
# /etc/init.d/httpd restart

Test PHP on your Centos 6

To make sure PHP works on your Dedicated Server, we are going to create a phpinfo file, which also will show you PHP version, server information and a lot more details about PHP on your Dedicated Server.

# yum install nano
# nano /var/www/html/info.php

Add this to your info.php file and save it.

<?php
phpinfo();
?>

You should be able to see your info.php file via http://yourip/info.php or http://yourdomain/info.php

By now you should have a working LAMP Linux, Apache, MySQL, PHP on your Centos 6 Dedicated Server. All your html or php files should be placed in /var/www/html/

Leave a Reply

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