Saturday, 30 June 2012

Installing Mysql on Centos

First we need to check mysql installed or not

          [root@sysadmin ~]#  rpm   -qa   mysql

Then not installed run this command

         [root@sysadmin ~]#  yum   install   mysql   mysql-server  -y

After installing the mysql and start the mysql daemon service

          [root@sysadmin ~]#   /etc/init.d/mysqld   restart

Output could like this

           Stopping mysqld: [ OK ]
Initializing MySQL database: Installing MySQL system tables...
Filling help tables...

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

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 linux password 'new-password'

Alternatively you can run:

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
cd /usr/mysql-test ; perl

Please report any problems with the /usr/bin/mysqlbug script!

[ OK ]
Starting mysqld: [ OK ]  

Set a password for root user at first time

           [root@sysadmin ~]#  mysqladmin   -u   root   password   'new-password'

Now installed the mysql.

Mysql starts automatically whenever the system boot so we will run this command

          [root@sysadmin ~]#   chkconfig   mysqld   on

Tuesday, 12 June 2012

How to configure Apache Server on CentOS

Edit configuration file :

Open the Apache configuration file following location and modify

        [root@sysadmin]#  vim   /etc/httpd/conf/httpd.conf

                    DocumentRoot  "/var/www/html/manivel/"

             save and close.

Now Restart the service

            [root@sysadmin]#  /etc/init.d/httpd  restart

Disable Security Enhanced Linux (SElinux) :

             [root@sysadmin]#  vim /etc/selinux/config

Check Security Enhanced Linux status using following command

            [root@sysadmin]#  getenforce

Disable Firewall setting :

           [root@sysadmin ~]#   system-config-firewall-tui

You want with Firewall setting follow 

Start the iptables service

       [root@sysadmin ~]#   /etc/init.d/iptables  start

Write iptables rule to allow HTTP (or) port 80

       [root@sysadmin ~]#   iptables   -t   filter  -A   INPUT   -i   eth0  -p   tcp   --dport  80   -j   ACCEPT

Save the above rule using below command

        [root@sysadmin ~]#   /etc/init.d/iptables  save

Now Restart the iptables service

        [root@sysadmin ~]#   /etc/init.d/iptables  restart

Testing HTTP working or not

Yes, HTTP is working.

Thursday, 7 June 2012

How to install Apache server in Linux

Apache is one of the most popular web servers in Linux.

Install Apache HTTP Server on Centos 

          [root@sysadmin ~]#  yum   install   httpd   httpd-devel

 Now start the service

         [root@sysadmin ~]#  /etc/init.d/httpd  start

Set the apache service to start on boot

         [root@sysadmin ~]#  chkconfig  httpd  on

How to upgrade Apache HTTP server on Centos

First stop the apache service

         [root@sysadmin ~]#  /etc/init.d/httpd  stop

Then take backup the Apache configuration file

         [root@sysadmin ~]#  cp   -p   /etc/httpd/conf/httpd.conf   /httpd.conf-bkp

Upgrade the Apache HTTP server

         [root@sysadmin ~]#  yum   upgrade   httpd

Now Restart the service

          [root@sysadmin ~]#  /etc/init.d/httpd  restart