Configure LAMP for CentOS7 and lamp for centos7

Source: Internet
Author: User
Tags ssh server

Configure LAMP for CentOS7 and lamp for centos7

Bring new colleagues in these two days. No way. I only want to learn how to sell it now and return to Linux. I want to configure the LAMP environment tonight, but I used 6.6. I want to make a big noise tonight. I want to try 7 at a time. I found a lot of tutorials online, but it seems that I am not responsible for the reprinting. Some of them will report an error directly between the next step. An odd mistake. Record the LAMP files for later viewing.

Install common tools Rsync

yum -y install rsync

Vim

yum -y install vim

Configure password-free login to the ssh server

Refer to my friends blog

Install LAMP

Although you can search for a large number of configuration tutorials on Baidu, what makes you embarrassed is that you don't know which one is useful. Every time I do experiments between various posts, especially many posts marked with the word "Turn", the source is not clear, the year is unknown, the fish and dragons are mixed, it takes N hours to match. The advantage of writing your own blog is to record your own painful experiences to ensure that they are easy to use each time.

yum -y install httpdInstall the Apache server. The default version so far is 2.4.6.

The next step isyum -y install mysql*? Of course not! If you like to install MariaDB like me (if you don't know about MariaDB, you can use Baidu MariaDB and MySQL), you can install community version MySQL:

Yum-y install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm// the default source cannot find the community version of yum-y install mysql-community-server

Of course, this is not all about installation. I used to choose this option because the PDO examples in the official PHP documentation are MySQL and do not support MariaDB. I cannot remember the specifics.

yum -y install phpInstall PHP
yum -y install php-mysqlInstall the fit device (heavy fog)
yum -y install php-gdI don't know what it is, but it won't work if it's not installed.

service mysqld startservice httpd start

Start these two services.

Install PDO in other configurations. Refer to this blog

Thanks to the original author. I posted one line directly.
yum -y install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt

Initialize MySQL password

mysql_secure_installationCommand to set the initial password.

How can we allow remote access to MySQL? I couldn't figure it out all morning. I used the above command after redoing the system and set the root password. One option was calledDisallow root login remotely? [Y/n]You must select n to allow remote access by the root user.

After logging on to mysql, use mysql to switch to the mysql database, and check whether the root user has a host name corresponding to % in the user table. If not, use
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;
Let's take a look. root can replace the username you want to add. % represents any IP address. The password is required. It is the password you used to authenticate the logon. Many domestic posts did not explain the meaning of this line of command, so it took half a day to succeed.
The following statement is used to refresh the permission and make the configuration take effect immediately.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.