CentOS7 builds apache, mysql, php, and phpmyadmin Environments
I recently watched laruence's Private food Linux, so I was buying a foreign server to work hard. First, I set up a basic web server. I encountered various pitfalls in the process. I summarized them and wrote them to avoid them.
1. Install the apache server
// 1. install the apache server.-y indicates that all subsequent prompts are sent through yum install httpd-y // 2. start apache server systemctl start httpd // other Common commands // restart apache server systemctl restart httpd // disable apache server systemctl stop httpd // 3. enable the apache server to start systemctl enable httpd. service
2. Install the mysql database
Install mariadb data. This database is a branch of mysql and is maintained by dedicated personnel. It is recommended. After all, you know that mysql has been acquired by oracle.
// 1. install mariadb (mysql) database yum install mariadb-server-y // 2. start the mariadb service systemctl start mariadb // other commands // restart the mariadb service systemctl restart mariadb // stop the mariadb service systemctl stop mariadb // 3. enable the mariadb service to start the systemctl enable mariadb
Configure the mariadb Database
// 1. enter this command to configure mysql_secure_installation // 2. you will be prompted to Enter the current root password. If you have not set the password, press enter current password for root (Enter for none): // 3. prompt whether to Set the root password, enter y, and press enter Set root password? [Y/n] // 4. enter the root password New password: // 5. confirm the root password Re-enter new password: // 6. remove anonymous users, enter y, and press enter to Remove anonymous users? [Y/n] // 7. disable remote root user logon. This depends on your individual needs. If you want to remotely connect to mysql, enter n and press Enter. If you do not allow remote connection to mysql, enter y, enter Disallow root login remotely? [Y/n] // 8. Do you want to Remove the test database? If you don't want it, enter y and press enter to Remove test database and access to it? [Y/n] // 9. Refresh permissions and tables, enter y, and press ENTER Reload privilege tables now? [Y/n]
Now, mariadb has been installed and configured.
3. Install the php Environment
// 1. install php and Its Extensions, php5.4yum install php-mysql php-gd libjpeg * php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash- y // 2. to Upgrade php to 5.6/7.0/2.1, you must first upgrade the software repository, run the following two commands in sequence: rpm-Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm-Uvh https://developer.webtatic.com/yum/el7/webtatic-release.rpm//2.2delete the version required for installing the old phpyum remove php-common // 2.3, version 5.6, yum install-y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring // 2.3 installation required version, 7.0 yum install-y php70w php70w-opcache php70w-xml php70w-mcrypt php70w-gd php70w-devel php70w-mysql php70w-intl php70w-mbstring/3. check whether php has been installed successfully. php-v // you can view your installed php version. // 4. restart the server systemctl restart httpd
4. Install the phpmyadmin Database Management System
// 1. download phpmyadmin package wget plugin phpMyAdmin-4.7.0-all-languages.zip // 2. if unzip and zip are not installed, install them first, and then execute the above operation yum install zip unzip-y // 3. move the decompressed phpmyadmin to the/var/www/html/phpmyadmin folder // 3.1 first create the phpmyadmin folder mkdir/var/www/html/phpmyadmin // 3.2 mobile file mv phpMyAdmin-4.7.0-all-languages/ */var/www/html/phpmyadmin // 4. restart apache server systemctl restart httpd
Then you can enterIP address or domain name/phpmyadmin
Now, CentOS7 has installed apache, mysql, php, and phpmyadmin.