Recently there is a project that involves the static operation of a website. The site is running in a lamp environment. In order to better simulate the real operating environment, and easy to test. The target site needs to be ported to the on-premises environment. Because I am accustomed to working under the Wamp, and now the request is in the real lamp environment. Then we need to build a lamp environment, this article will record some of the problems encountered in the process of building the environment.
Build lamp Environment
The Linux system is not familiar, but some basic operations will be. Also know Yum and RPM. So it's generally clear what to do.
At the very beginning, I installed a CentOS operating system on my virtual machine. Then follow the http://www.jb51.net/article/24775.htm this article to install. It's a really successful installation.
The specific steps are excerpted as follows:
1, replace the Yum source (of course you can not change the source just to download resources more quickly. I installed two times, once did not change the source, once changed. The download speed is not the same)
1.1 Backup Centos-base.repo
cd/etc/yum.repos.d/
CP Centos-base.repo Centos-base.repo.bak
1.2 Replace Source
Open the Centos-base.repo with VI and clear the contents, then copy and save the contents below.
# Centos-base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis Forcentos.
# The Mirror system uses the connecting IP address of the client and the
# Update status of each mirror to pick mirrors that is updated to and
# Geographically close to the client. You should use this for centosupdates
# Unless you is manually picking other mirrors.
#
# If The mirrorlist= does not work for you, as a fall back can trythe
# remarked out Baseurl= line instead.
#
#
[Base]
name=centos-$releasever-base
baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch/
Gpgcheck=1
Gpgkey=http://mirrors.sohu.com/centos/rpm-gpg-key-centos-5
#released Updates
[Updates]
name=centos-$releasever-updates
baseurl=http://mirrors.sohu.com/centos/$releasever/updates/$basearch/
Gpgcheck=1
Gpgkey=http://mirrors.sohu.com/centos/rpm-gpg-key-centos-5
#packages used/produced in the build and not released
[Addons]
name=centos-$releasever-addons
baseurl=http://mirrors.sohu.com/centos/$releasever/addons/$basearch/
Gpgcheck=1
Gpgkey=http://mirrors.sohu.com/centos/rpm-gpg-key-centos-5
#additional packages that could be useful
[Extras]
name=centos-$releasever-extras
baseurl=http://mirrors.sohu.com/centos/$releasever/extras/$basearch/
Gpgcheck=1
Gpgkey=http://mirrors.sohu.com/centos/rpm-gpg-key-centos-5
#additional packages that extend functionality of existing packages
[Centosplus]
name=centos-$releasever-plus
baseurl=http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/
Gpgcheck=1
Enabled=0
Gpgkey=http://mirrors.sohu.com/centos/rpm-gpg-key-centos-5
1.3 Update.
Yum-y Update
2, install Apache,mysql with yum. Php.
2.1 Installing Apache
Yum Install httpd Httpd-devel
When the installation is complete, start Apache with/etc/init.d/httpd start
Set to boot: Chkconfig httpd on
2.2 Installing MySQL
2.2.1 Yum install MySQL Mysql-servermysql-devel
Again, when done, start MySQL with/etc/init.d/mysqld start
2.2.2 Setting the MySQL password
mysql>; Use MySQL;
mysql>; UPDATE user SET Password=password (' newpassword ') whereuser= ' root ';
mysql>; FLUSH privileges;
2.2.3 Allow remote logins
Mysql-u root-p
Enter Password: <your new password>
Mysql>grant all privileges on * * to ' user name ' @ '% ' identified by ' password ' with GRANT OPTION;
When you're done, you can manage MySQL remotely with Mysql-front.
2.2.4 Set to boot
Chkconfig mysqld on
Where I only use 2.2.2 to set the MySQL password. After the Allow boot up, allow remote login these are not set.
3, install PHP
Yum install php php-mysql php-common php-gd php-mbstringphp-mcrypt php-devel php-xml
/ETC/INIT.D/HTTPD start
4, test
4.1 Create a new test.php file in/var/www/html/, write the following, and then save.
<?
Phpinfo ();
?>
5, firewall configuration
A. Add. Allow access to port {21:ftp, 80:http}.
Iptables-i rh-firewall-1-input-m state–state new-m tcp-p tcp–dport 21-jaccept
Iptables-i rh-firewall-1-input-m state–state new-m tcp-p tcp–dport 80-jaccept
B. Turn off firewall {not recommended}.
Service Iptables Stop
C. Resetting the load firewall
Service Iptables Restart
Because I am using the test environment, I directly shut down the firewall, and then I can enter the IP address in the browser access
When the lamp environment was built, I did see the results of the phpinfo () input in the browser. But at the same time I found a file, PHP version is 5.16. This version is too low to run Joomla at all. Then I have to solve the other problem now. How to upgrade the PHP version.
Solve the problem of PHP version too low
The lamp environment was set up, but the PHP version was low and could not be run. Some programs have been found online. How to get to the PHP version of CentOS 5.8. And also try to do it. But none of them worked. Finally, chatting with a friend, he thought my CentOS version was too low. CentOS is now 7.0. So he suggested that I go to download a new version of CentOS.
As follows:
http://mirrors.163.com/centos/6.5/isos/i386/
Just download DVD1 and DVD2 on the line. In the actual installation, only the DVD1 is used.
A new CentOS 6.5 is installed and then the process is re-run. (There may be no modification to the Yum source this step, specifically there has been forgotten.) PHP now has a version of 5.3.3. The basic environment is enough.
Installing phpMyAdmin
Use phpMyAdmin in the WAMP environment to create the database. So I want to install a phpmyadmin in Linux, too. Found some information. Finally, because of the relationship between time and give up. Because I don't need a lot of database operations. Just creating a database is enough. Enter MySQL under the console and enter CREATE DATABASE DatabaseName to proceed to the next Joomla installation.
Installing Joomla
At this point, it's easy. Make a backup of the original site directly with Akeeba. Then the recovery. In the process of recovery. There was the first question--not to write. Soon became aware of the Linux system's permissions problem. Using the Chmod-r 777 DirName solves this problem. Although the 777 is not very good, but in the test environment can still be given.
The installation was smooth after that. Just go straight to the next step.
That should have been done. But when I browsed the site, I found that there was a homepage, but no connection on the home page can be clicked, there are 404 errors. With experience, this is related to the Apache rewrite module. Then the next step is to solve the rewrite problem.
Resolved out of the home page appears, other pages are 404 of the problem
This problem is caused by an Apache rewrite error. I followed the steps below to check
1, login background, confirm that the Apche rewrite module is enabled in the global settings.
2, login backstage, confirm the Mod_rewrite module is loaded in System information
3, confirm that there is a. httrack file in the more directory on the website, and confirm that there is no problem with the root path.
After the above 3 checks, the discovery still cannot solve the problem. That's a strange thing. So I wonder if it's Apache. Additional settings are required to enable the Mod_rewrite feature.
The following information was found on the Internet: http://jingyan.baidu.com/article/a65957f4a4209a24e77f9b55.html
Recently do WordPress, found that fixed links are always not set. It was later discovered that the URL of the Apache server Rewirite module was not turned on.
After querying the data, finally set the success, record the next step: 1: Open the Apache url_rewrite module, in the httpd.conf to remove the comment of this sentence loadmodulerewrite_module Modules/mod_ Rewrite.so. (This sentence is commented by default, preceded by #) 2: Find AllowOverride, allowoverride none to allowoverride all (this is very important, do not do this setting, even if you do other operations, is also invalid). In addition, there are several places in this document that have this parameter, and if you do not understand it, get rid of it all. 3: Add the. htaccess file in the home directory of the Web that you want to rewrite, add the previous sentence: Rewriteengine on. In the. htaccess to supplement the individual rewrite rules can (generally have this file, just add the above sentence on it).
Step 2 is important, the meaning of this configuration is to let Apache go to
Read the corresponding configuration file,. htaccess belongs to one of the configuration files, and if the setting is none then the read is not valid.
According to the above tips, I found that because the 2nd article is not satisfied, yes, the rewrite function of Apache is invalid. After fixing this problem, restart the Apche server. Problem solving. It is important to note that the second is available in multiple places and needs to be modified in several places.
So far, the migration of Joomla has been completed successfully. One of the issues I need to address is: How do I fix the virtual machine's IP?
Joomla resource sharing channel: Http://www.zmax99.com/home-page/menu-cn-user-page/zmax-blog
Zmax Team-JOOMLA Professional development team
Joomla website Migration