{"id":5543,"date":"2016-01-03T18:12:22","date_gmt":"2016-01-03T10:12:22","guid":{"rendered":"http:\/\/rmohan.com\/?p=5543"},"modified":"2016-01-03T18:12:22","modified_gmt":"2016-01-03T10:12:22","slug":"install-lamp-phpmyadmin-on-7-centos-7-rhel","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=5543","title":{"rendered":"Install LAMP + phpMyAdmin on 7 CentOS 7 \/ RHEL"},"content":{"rendered":"<p>Install LAMP + phpMyAdmin on 7 CentOS 7 \/ RHEL<\/p>\n<p>The main attention is now replaced by the MySQL database MariaDB, and therefore representative of the LAMP Linux + Apache + MariaDB + PHP up.<\/p>\n<p>System: The new CentOS 7 using systemd, thus some instruction vary ; now use alternative MariaDB MySQL as the database software, there will also be installed directly MariaDB.<\/p>\n<p>Set HOSTNAME<\/p>\n<p>echo &#8220;HOSTNAME=clusterserver3.rmohan.com&#8221; &gt;&gt; \/etc\/sysconfig\/network<br \/>\nhostname &#8220;clusterserver3.rmohan.com&#8221;<\/p>\n<p>INSTALL VIM<\/p>\n<p>yum -y install vim<\/p>\n<p>To make a color display code, and also supports line numbers and mouse positioning mark, you need to edit vim configuration file:<\/p>\n<p>vim \/etc\/vimrc<\/p>\n<p>set nu<br \/>\nset mouse=a<\/p>\n<p>update configuration file \/etc\/hosts<\/p>\n<p>192.168.1.22 clusterserver3.rmohan.com clusterserver3<\/p>\n<p>remove the dhcp<\/p>\n<p>systemctl list-unit-files \u2013type=service dhcp<\/p>\n<p>add timezone<\/p>\n<p>ln -sf \/usr\/share\/zoneinfo\/Singapore \/etc\/localtime<br \/>\ntimedatectl set-timezone Asia\/Singapore ; timedatectl<\/p>\n<p>yum update<\/p>\n<p>install http<\/p>\n<p>yum install httpd<\/p>\n<p>http:\/\/192.168.1.22<\/p>\n<p>[root@clusterserver3 ~]# systemctl enable httpd<br \/>\nCreated symlink from \/etc\/systemd\/system\/multi-user.target.wants\/httpd.service to \/usr\/lib\/systemd\/system\/httpd.service.<br \/>\n[root@clusterserver3 ~]#<\/p>\n<p>firewall-cmd &#8211;add-service=http &#8211;permanent<br \/>\nfirewall-cmd &#8211;add-service=https &#8211;permanent<br \/>\nfirewall-cmd &#8211;zone=public &#8211;add-port=22\/tcp &#8211;permanent<\/p>\n<p>systemctl restart firewalld<\/p>\n<p>firewall-cmd &#8211;list-all<\/p>\n<p># firewall-cmd &#8211;state<br \/>\n# firewall-cmd &#8211;list-all<br \/>\n# firewall-cmd &#8211;list-interfaces<br \/>\n# firewall-cmd &#8211;get-service<br \/>\n# firewall-cmd &#8211;query-service service_name<br \/>\n# firewall-cmd &#8211;add-port=8080\/tcp<\/p>\n<p>install Mariadb<\/p>\n<p>yum install mariadb-server mariadb<\/p>\n<p>systemctl enable mariadb<\/p>\n<p>[root@clusterserver3 ~]# systemctl enable mariadb<br \/>\nCreated symlink from \/etc\/systemd\/system\/multi-user.target.wants\/mariadb.service to \/usr\/lib\/systemd\/system\/mariadb.service.<br \/>\n[root@clusterserver3 ~]#<\/p>\n<p>top -u mysql<\/p>\n<p>systemctl start mariadb<br \/>\nsystemctl stop mariadb<br \/>\nsystemctl restart mariadb<br \/>\nsystemctl disable mariadb<br \/>\nsystemctl is-active mariadb<\/p>\n<p>Test MariaDB server in the local virtual machine CentOS 7 system, every time execution mysql command will always encounter &#8220;ERROR 2006 (HY000): MySQL server has gone away&#8221; error. Calibration of the time within a virtual machine, the aforementioned problems hours. Is there a necessary connection between the two is not to say, temporarily be recorded.<\/p>\n<p>Execute an instruction casually in MariaDB, whether create database or just flush privileges or, before the implementation of the results will show a similar instruction such output,<\/p>\n<p>MariaDB [(none)]&gt; select now ();<br \/>\nERROR 1305 (42000): FUNCTION now does not exist<br \/>\nMariaDB [(none)]&gt;<\/p>\n<p>mysql_secure_installation<\/p>\n<p>[root@clusterserver3 ~]# mysql_secure_installation<br \/>\n\/usr\/bin\/mysql_secure_installation: line 379: find_mysql_client: command not found<\/p>\n<p>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB<br \/>\nSERVERS IN PRODUCTION USE!\u00a0 PLEASE READ EACH STEP CAREFULLY!<\/p>\n<p>In order to log into MariaDB to secure it, we&#8217;ll need the current<br \/>\npassword for the root user.\u00a0 If you&#8217;ve just installed MariaDB, and<br \/>\nyou haven&#8217;t set the root password yet, the password will be blank,<br \/>\nso you should just press enter here.<\/p>\n<p>Enter current password for root (enter for none):<br \/>\nERROR 1045 (28000): Access denied for user &#8216;root&#8217;@&#8217;localhost&#8217; (using password: YES)<br \/>\nEnter current password for root (enter for none):<br \/>\nOK, successfully used password, moving on&#8230;<\/p>\n<p>Setting the root password ensures that nobody can log into the MariaDB<br \/>\nroot user without the proper authorisation.<\/p>\n<p>Set root password? [Y\/n] Y<br \/>\nNew password:<br \/>\nRe-enter new password:<br \/>\nSorry, passwords do not match.<\/p>\n<p>New password:<br \/>\nRe-enter new password:<br \/>\nPassword updated successfully!<br \/>\nReloading privilege tables..<br \/>\n&#8230; Success!<\/p>\n<p>By default, a MariaDB installation has an anonymous user, allowing anyone<br \/>\nto log into MariaDB without having to have a user account created for<br \/>\nthem.\u00a0 This is intended only for testing, and to make the installation<br \/>\ngo a bit smoother.\u00a0 You should remove them before moving into a<br \/>\nproduction environment.<\/p>\n<p>Remove anonymous users? [Y\/n] y<br \/>\n&#8230; Success!<\/p>\n<p>Normally, root should only be allowed to connect from &#8216;localhost&#8217;.\u00a0 This<br \/>\nensures that someone cannot guess at the root password from the network.<\/p>\n<p>Disallow root login remotely? [Y\/n] y<br \/>\n&#8230; Success!<\/p>\n<p>By default, MariaDB comes with a database named &#8216;test&#8217; that anyone can<br \/>\naccess.\u00a0 This is also intended only for testing, and should be removed<br \/>\nbefore moving into a production environment.<\/p>\n<p>Remove test database and access to it? [Y\/n] y<br \/>\n&#8211; Dropping test database&#8230;<br \/>\n&#8230; Success!<br \/>\n&#8211; Removing privileges on test database&#8230;<br \/>\n&#8230; Success!<\/p>\n<p>Reloading the privilege tables will ensure that all changes made so far<br \/>\nwill take effect immediately.<\/p>\n<p>Reload privilege tables now? [Y\/n] y<br \/>\n&#8230; Success!<\/p>\n<p>Cleaning up&#8230;<\/p>\n<p>All done!\u00a0 If you&#8217;ve completed all of the above steps, your MariaDB<br \/>\ninstallation should now be secure.<\/p>\n<p>Thanks for using MariaDB!<br \/>\n[root@clusterserver3 ~]#<\/p>\n<p>MariaDB [(none)]&gt; show global variables like &#8216;max_allowed_packet&#8217;;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+<br \/>\n| Variable_name\u00a0\u00a0\u00a0\u00a0\u00a0 | Value\u00a0\u00a0 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+<br \/>\n| max_allowed_packet | 1048576 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+<br \/>\n1 row in set (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt;<\/p>\n<p>MariaDB [(none)]&gt; set global max_allowed_packet=1024*1024*16;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt; show global variables like &#8216;max_allowed_packet&#8217;;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+<br \/>\n| Variable_name\u00a0\u00a0\u00a0\u00a0\u00a0 | Value\u00a0\u00a0\u00a0 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+<br \/>\n| max_allowed_packet | 16777216 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+<br \/>\n1 row in set (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt;<br \/>\ntime in centos 7<br \/>\nyum -y -q install ntp<br \/>\nntpdate -s ntp.org<br \/>\ndate<\/p>\n<p>MariaDB [(none)]&gt; select now();<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| now()\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| 2016-01-03 16:18:47 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n1 row in set (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt;<br \/>\nType &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt; select now();<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| now()\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| 2016-01-03 07:15:34 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n1 row in set (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt;<\/p>\n<p>yum install php<\/p>\n<p>cp \/etc\/php.ini ~\/confbak\/php.ini.bak<br \/>\ncp \/etc\/httpd\/conf.d\/php.conf ~\/confbak\/httpd\/conf.d\/php.conf.bak<br \/>\ncp \/etc\/httpd\/conf.modules.d\/10-php.conf ~\/confbak\/httpd\/conf.modules.<\/p>\n<p>vi \/etc\/php.ini<\/p>\n<p>error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR<br \/>\ndisplay_errors = Off<br \/>\nlog_errors = On<br \/>\nmax_execution_time = 300<br \/>\nmemory_limit = 32M<\/p>\n<p>yum install php-mysql<\/p>\n<p>yum install http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/e\/epel-release-7<\/p>\n<p>yum install phpmyadmin<\/p>\n<p>cp \/etc\/httpd\/conf.d\/phpMyAdmin.conf ~\/confbak\/httpd\/conf.d\/phpMyAdmin.conf.bak<\/p>\n<p>#Alias \/phpMyAdmin \/usr\/share\/phpMyAdmin<br \/>\n#Alias \/phpmyadmin \/usr\/share\/phpMyAdmin<\/p>\n<p>&lt;Directory \/usr\/share\/phpMyAdmin\/&gt;<br \/>\n&#8230;&#8230;&#8230;<br \/>\n&lt;\/Directory&gt;<\/p>\n<p>Require ip 127.0.0.1<br \/>\nRequire ip ::1<\/p>\n<p>cp \/etc\/phpMyAdmin\/config.inc.php ~\/confbak\/config.inc.php.bak<br \/>\nvi \/etc\/phpMyAdmin\/config.inc.php<\/p>\n<p>$cfg[&#8216;blowfish_secret&#8217;] = &#8216;password&#8217;<\/p>\n<p>systemctl restart httpd<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install LAMP + phpMyAdmin on 7 CentOS 7 \/ RHEL<\/p>\n<p>The main attention is now replaced by the MySQL database MariaDB, and therefore representative of the LAMP Linux + Apache + MariaDB + PHP up.<\/p>\n<p>System: The new CentOS 7 using systemd, thus some instruction vary ; now use alternative MariaDB MySQL as the database [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5543"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5543"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5543\/revisions"}],"predecessor-version":[{"id":5544,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5543\/revisions\/5544"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}