Understand, Learn and Implement.. LINUX / UNIX DEVOPS CONTAINERS OPENSHIFT KUBERNETES DEVOPS TOOLS VIRTUALIZATION STORAGE BACKUP SCRIPTS MONITORING MIDDLEWARE

Friday, August 28, 2015

LAMP Setup in RHEL6

To install apache, open terminal and type in this command:

[root@client ~]# yum install httpd
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use su                                                                                                                                                             bscription-manager to register.
Setting up Install Process
Package httpd-2.2.15-29.el6_4.x86_64 already installed and latest version
Nothing to do
[root@client ~]#

[root@client ~]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified                                                                                                                                                              domain name, using 192.168.0.1 for ServerName
                                                           [  OK  ]

To install MySQL, open terminal and type in these commands:

[root@client ~]# yum install mysql-server
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.x86_64 0:5.1.71-1.el6 will be installed
--> Processing Dependency: mysql = 5.1.71-1.el6 for package: mysql-server-5.1.71-1.el6.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.71-1.el6.x86_64
--> Running transaction check
---> Package mysql.x86_64 0:5.1.71-1.el6 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================
 Package                                      Arch                                 Version                                       Repository                          Size
==========================================================================================================================================================================
Installing:
 mysql-server                                 x86_64                               5.1.71-1.el6                                  repo                               8.6 M
Installing for dependencies:
 mysql                                        x86_64                               5.1.71-1.el6                                  repo                               893 k
 perl-DBD-MySQL                               x86_64                               4.013-3.el6                                   repo                               134 k

Transaction Summary
==========================================================================================================================================================================
Install       3 Package(s)

Total download size: 9.6 M
Installed size: 27 M
Is this ok [y/N]: y
Downloading Packages:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                      38 MB/s | 9.6 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql-5.1.71-1.el6.x86_64                                                                                                                              1/3
  Installing : perl-DBD-MySQL-4.013-3.el6.x86_64                                                                                                                      2/3
  Installing : mysql-server-5.1.71-1.el6.x86_64                                                                                                                       3/3
  Verifying  : perl-DBD-MySQL-4.013-3.el6.x86_64                                                                                                                      1/3
  Verifying  : mysql-server-5.1.71-1.el6.x86_64                                                                                                                       2/3
  Verifying  : mysql-5.1.71-1.el6.x86_64                                                                                                                              3/3

Installed:
  mysql-server.x86_64 0:5.1.71-1.el6

Dependency Installed:
  mysql.x86_64 0:5.1.71-1.el6                                                     perl-DBD-MySQL.x86_64 0:4.013-3.el6

Complete!

[root@client ~]# 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 client 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  ]
[root@client ~]#

Once it is done installing, you can set a root MySQL password::

[root@client ~]# usr/bin/mysql_secure_installation
-bash: usr/bin/mysql_secure_installation: No such file or directory
[root@client ~]# /usr/bin/mysql_secure_installation




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):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
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!


[root@client ~]#

To install PHP on your virtual private server, open terminal and type in this command:

[root@client ~]# yum install php php-mysql
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.3-26.el6 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.3-26.el6 for package: php-5.3.3-26.el6.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.3.3-26.el6 for package: php-5.3.3-26.el6.x86_64
---> Package php-mysql.x86_64 0:5.3.3-26.el6 will be installed
--> Processing Dependency: php-pdo(x86-64) for package: php-mysql-5.3.3-26.el6.x86_64
--> Running transaction check
---> Package php-cli.x86_64 0:5.3.3-26.el6 will be installed
---> Package php-common.x86_64 0:5.3.3-26.el6 will be installed
---> Package php-pdo.x86_64 0:5.3.3-26.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                    Arch                                                   Version                                                        Repository                                            Size
=============================================================================================================================================================================================================================================
Installing:
 php                                                        x86_64                                                 5.3.3-26.el6                                                   repo                                                 1.1 M
 php-mysql                                                  x86_64                                                 5.3.3-26.el6                                                   repo                                                  81 k
Installing for dependencies:
 php-cli                                                    x86_64                                                 5.3.3-26.el6                                                   repo                                                 2.2 M
 php-common                                                 x86_64                                                 5.3.3-26.el6                                                   repo                                                 525 k
 php-pdo                                                    x86_64                                                 5.3.3-26.el6                                                   repo                                                  75 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install       5 Package(s)

Total download size: 4.0 M
Installed size: 13 M
Is this ok [y/N]: y
Downloading Packages:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                         26 MB/s | 4.0 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : php-common-5.3.3-26.el6.x86_64                                                                                                                                                                                            1/5
  Installing : php-cli-5.3.3-26.el6.x86_64                                                                                                                                                                                               2/5
  Installing : php-pdo-5.3.3-26.el6.x86_64                                                                                                                                                                                               3/5
  Installing : php-mysql-5.3.3-26.el6.x86_64                                                                                                                                                                                             4/5
  Installing : php-5.3.3-26.el6.x86_64                                                                                                                                                                                                   5/5
  Verifying  : php-5.3.3-26.el6.x86_64                                                                                                                                                                                                   1/5
  Verifying  : php-mysql-5.3.3-26.el6.x86_64                                                                                                                                                                                             2/5
  Verifying  : php-cli-5.3.3-26.el6.x86_64                                                                                                                                                                                               3/5
  Verifying  : php-common-5.3.3-26.el6.x86_64                                                                                                                                                                                            4/5
  Verifying  : php-pdo-5.3.3-26.el6.x86_64                                                                                                                                                                                               5/5

Installed:
  php.x86_64 0:5.3.3-26.el6                                                                                          php-mysql.x86_64 0:5.3.3-26.el6

Dependency Installed:
  php-cli.x86_64 0:5.3.3-26.el6                                                php-common.x86_64 0:5.3.3-26.el6                                                php-pdo.x86_64 0:5.3.3-26.el6

Complete!
[root@client ~]# yum search php-
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
============================================================================================================= N/S Matched: php- =============================================================================================================
php-cli.x86_64 : Command-line interface for PHP
php-common.x86_64 : Common files for PHP
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-ldap.x86_64 : A module for PHP applications that use LDAP
php-mysql.x86_64 : A module for PHP applications that use MySQL databases
php-odbc.x86_64 : A module for PHP applications that use ODBC databases
php-pdo.x86_64 : A database access abstraction module for PHP applications
php-pear.noarch : PHP Extension and Application Repository framework
php-pecl-apc.x86_64 : APC caches and optimizes PHP intermediate code
php-pecl-memcache.x86_64 : Extension to work with the Memcached caching daemon
php-pgsql.x86_64 : A PostgreSQL database module for PHP
php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php-xml.x86_64 : A module for PHP applications which use XML
php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol

  Name and summary matches only, use "search all" for everything.


[root@client ~]# chkconfig httpd on
[root@client ~]# chkconfig mysqld on
[root@client ~]# nano /var/www/html/info.php
[root@client ~]# cat /var/www/html/info.php
phpinfo();
?>:q

[root@client ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.0.1 for ServerName
                                                           [  OK  ]
[root@client ~]#

1 comment: