Move the php website to CentOS 6.7 [1]: Install the lamp environment in yum, centoslamp
Recently, at the teacher's request, I transferred a website from 51php to the server provided by the school. I didn't know about Linux before, and everything was done on Baidu. As a result, I forgot to complete many steps. Now I will record the valid steps for your next reference.
The servers on 51php were Linux, php 5.2, mysql 5.1.65, and Apache 2. Get the school server's ip address, account, password, download a PuTTY, and then perform ssh access. I tried to install vnc before, but encountered a lot of trouble and was forced to install the lamp environment first, set up the project, and install vnc later.
View server version
# head -n 1 /etc/issue
Only by understanding the version and other details of the operating system can you know which operations are supported by the system and then decide the method used for installation. The school server is CentOS 6.7x64.
I browsed some articles and found two suitable articles:
Learn how to install the lamp environment, learn how to modify firewall settings
The former tells about the detailed installation process, but the firewall setting is a bit confusing for new users. I saw the detailed setting process in the latter, so I posted the links to both blogs.
Here is a simple excerpt:
# Update # yum-y update # install Apache, start Apache, and set self-start # yum install httpd-devel #/etc/init. d/httpd start # chkconfig httpd on # install mysql and start # yun install mysql-server mysql-devel #/etc/init. d/mysqld start # Switch to mysql and set the mysql Password # mysqlmysql> use mysql; mysql> UPDATE user set PASSWORD = Password ("new PASSWORD") WHERE user = "root "; mysql> flush privileges; # switch back to ssh to allow remote logon # mysql-u root-pEnter Password: <new Password> mysql> G Rant all privileges on *. * TO 'username '@' % 'identified by 'Password' with grant option; # switch back TO ssh, set mysql self-start # chkconfig mysqld on # install php # yum install php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml #/etc/init. d/httpd start # Set the firewall to enable port 80 and other ports, such as port 3306 and port 22. You can use the vi command, you can also use ftp # service iptables stop # vi/etc/sysconfig/iptables # To add A rule:-a input-m state -- state NEW-m tcp-p tcp -- dpor T 80-j ACCEPT # service iptables restart # errors may occur during restart, such as rule application failure, you can try to change the location of the added rule # test # create a test in/var/www/html/by using ftp or other methods, such as vi commands. php and save the content as follows: <? Php phpinfo ();?> # Access http: // website domain name or ip address/test. php In the browser. If it is displayed successfully, the configuration is successful.