LAMP configuration in CentOS6.6

Source: Internet
Author: User
Tags mcrypt what is lamp

LAMP configuration in CentOS6.6
What is LAMP?


LAMP = Linux + Apache + MySQL/MariaDB + Perl/PHP/Python


A set of open-source software commonly used to build dynamic websites or servers are independent programs. However, because they are often used together, they have a higher degree of compatibility, A powerful Web application platform. With the rapid development of open source, open source code LAMP has been integrated with J2EE and. net commercial software has formed a three-pronged trend, and the software development project has a low investment cost in software, so it has received the attention of the entire IT industry. More than 70% of website traffic is provided by LAMP, which is the most powerful website solution.




First, update yum-y update.





4. install Apache, Mysql, and PHP with yum.





Install Apache
Yum install httpd-devel
After the installation is complete, start apache with/etc/init. d/httpd start
Set to boot: chkconfig httpd on




Install mysql
Yum install mysql-server mysql-devel
Similarly, start mysql with/etc/init. d/mysqld start




Set mysql password
Mysql>; USE mysql;
Mysql>; UPDATE user SET Password = PASSWORD ('newpassword') WHERE user = 'root ';
Mysql>; flush privileges;


You can also use the mysql_secure_installation command to set the mysql password.







Allow Remote Login
Mysql-u root-p
Enter Password: <your new password>
Mysql> grant all privileges on *. * TO 'username '@' % 'identified by 'Password' with grant option;
After that, you can use mysql-front to remotely manage mysql.
Set to boot
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




Test
Create a test. php file in/var/www/html/, write the following content, and save the file.
<?
Phpinfo ();
?>
Firewall Configuration
A. Add. Allow access to port {80: http }.
-A input-m state -- state NEW-m tcp-p tcp -- dport 80-j ACCEPT
B. Disable the firewall {not recommended }.
Service iptables stop
C. Reset and load the Firewall
Service iptables restart




Then open http: // serverip/test. php In the client browser. If it is displayed successfully, the installation is successful.
So far, the installation is complete.




Centos virtual machine, allowing remote access to specific ports




Modification method:
Switch to the root user
Open the iptables configuration file vi/etc/sysconfig/iptables. old.
-A input-m state -- state NEW-m tcp-p tcp -- dport 80-j ACCEPT


To solve the problem, you must first know the problem, so you must know more details about the problem. You only need to configure php. ini. Find the php. ini file in the php installation directory and open it. Find display_errors. By default, display_errors = Off, change Off to On, save and close the file, and restart apache.


Start command:
/Etc/init. d/httpd start apache


Start mysql with/etc/init. d/mysqld start


Store PHP files in the var/www/html directory




Install and configure phpmyadmin in Linux


This installation and configuration is performed on the centos 6.6 system. The lnmp environment has been deployed on the system. For phpmyadmin installation, you can select the yum online installation method, download it from its official website, and decompress it to your web server directory.


Step 1 configure the rpmforge and epel source for centos. The official centos source is actually enough, but some extensions like php, such as php-mcrypt, are not available in official sources.
You can find the latest version of rpmforge source in release-*. i686.rpm or rpmforge-release-*. x86_64.rpm.
The epel source can be found in the http://mirrors.ustc.edu.cn/Fedora/epel/6/, 32 systems in the i386 folder, 64-bit in the x86_64 folder, named epel-release-6-*. noarch. rpm, to find the latest version

Http://pkgs.repoforge.org/rpmforge-release/ rpmforge source download

Http://mirrors.opencas.cn/epel/6/i386/ epel source download


Here we use a 32-bit system as an example,
# If The system prompts The requested URL returned error: 404, replace it with The latest version.
Rpm-ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm for viewing records in a Virtual Machine (in the txt directory on the desktop)
Rpm-ivh http://download.Fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm




# Install php extensions
Yum-y install php-mysql php-gd php-imap php-ldap php-odbc php-mbstring php-devel php-soap php-cli php-pdo
Yum-y install php-mcrypt php-tidy php-xml php-xmlrpc php-pear


# Install phpmyadmin
Yum-y install phpmyadmin


After the installation is complete, you can find phpMyAdmin in the/usr/share directory and copy it to your web directory. For example, my web directory is/var/www/html.
Modify the config. inc. php file in the directory


$ Cfg ['pmaabsoluteuri '] = 'HTTP: // 192.168.229.130/phpmyadmin'; // address of phpmyadmin


$ Cfg ['servers'] [$ I] ['host'] = '192. 168.229.130 '; // set the host name or IP address of mysql. The default localhost is used.


$ Cfg ['servers'] [$ I] ['auth _ type'] = 'cookier'; // use config for local debugging; otherwise, use cookie. cookie is recommended.


$ Cfg ['servers'] [$ I] ['user'] = 'root'; // set the mysql user name


$ Cfg ['servers'] [$ I] ['Password'] = 'Password'; // set the mysql user password


$ Cfg ['defaultlang '] = 'zh-UTF-8'; // set the default language


After setting the preceding parameters, save and exit. Restart the web server. Open the browser and enter http: // 192.168.229.130/phpmyadmin in the address bar to test the settings.

Related Article

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.