Build lamp in ubuntu

Source: Internet
Author: User
1. use apt-get to install PHP + MYSQL + Apache in Ubuntu and execute the following commands: (1) install MYSQLsudoapt-getinstallmysql-serversudoapt-getinstallmysql-client (2) install Apachesudoapt-getinstallapache2 (... 1. use apt-get to install PHP + MYSQL + Apache in Ubuntu and execute the following commands: (1) install MYSQL sudo apt-get install mysql-server sudo apt-get install mysql-client (2) install Apache sudo apt-get install apache2 (3) install PHP www.2cto.com sudo apt-get install php5 sudo apt-get install libap Ache2-mod-auth-mysql sudo apt-get install after the php5-mysql is installed, check for success: (1) check if Mysql is normal input in the terminal: mysql-uusername-ppassword (replace username and password with the one you set) to check whether logs can be logged on normally (2) Check whether Apache is opened normally in the browser: http: // localhost/if the following information appears, it indicates normal. It works! This is the default web page for this server. www.2cto.com The web server software is running but no content has been added, yet. (3) Check If PHP is normal. the default installation path of Apache in Ubuntu is/var/www/, and create info in the directory. php file with the following content: Open it in the browser: http://localhost/info.php Check whether it is normal. Note: You do not have permission to directly create a file in this directory. add the current user permission to the File: su root (root user) chown username/var/www (replace username with your current user name) exit (exit root) if your ubuntu system root user is not available, this is because the default root password of ubuntu is empty. you can set the password by using the following command: sudo passwd-l root 2. manually compile and install PHP + MYSQL + Apache www.2cto.com on Ubuntu 1. download the software MySql: wget http://down1.chinaunix.net/distfiles/mysql-5.0.56.tar.gz Apache: wget http://apache.freelamp.com/httpd/httpd-2.2.13.tar.gz PHP: wget http://125.39.113.23:9203/CDE349DEF7D7A6AC19DE5771F752CA258C693F634815D4BE/cn.php.net/distributions/php-5.2.10.tar.bz2 2. install MySql installation steps: shell> groupadd mysql www.2cto.com shell> useradd-g mysql shell> gunzip <mysql-VERSION.tar.gz | tar-xvf-or tar-zxvf mysql-5.0.56.tar.gz (unzip the mysql source package) shell> cd mysql-VERSION (enter the mysql source code folder) shell>. /configure-prefix =/usr/local/mysql shell> make install shell> cp support-files/my-medium.cnf/etc/my. cnf shell> cd/usr/local/mysql shell> bin/mysql_install_db-user = m Ysql www.2cto.com shell> chown-R root. shell> chown-R mysql var shell> chgrp-R mysql. shell> bin/mysqld_safe-user = mysql & modify mysql root password $ mysqladmin-u root password newpass add service item cp/usr/local/mysql/share/mysql. server/etc/init. d/mysqldchmod 755/etc/init. d/mysqldchkconfig-add mysqld www.2cto.com 3. install Apache tar zvxf httpd-2.2.13.tar.gzcd httpd-2.2.13 to modify src/include/httpd. h. increase the maximum number of threads # defi Change ne HARD_SERVER_LIMIT 256 to # define HARD_SERVER_LIMIT 2560 www.2cto.com to save and exit apache compilation. /configure-prefix =/usr/local/apache-enable-module = so-enable-module = rewrite-enable-shared = max-htdocsdir =/var/www & makemake install # Here we use the enable-module parameter to tell the setting script, we need to start the so and rewrite modules. The so module is used to extract the apache core module supported by DSO, while the rewrite module is designed to implement address rewriting. because the rewrite module requires DBM support, if it is not compiled into apache during the initial installation, you need to re-compile the entire apache before it can be implemented. Therefore, unless you are sure that the rewrite module will not be used in the future, we recommend that you compile the rewrite module during the first compilation. Enable-shared = max when compiling apache, all apache standard modules except so are compiled into DSO modules. Instead of compiling it into the apache core. It's easy to install apache. start apache and check www.2cto.com/usr/local/apache/bin/apachectl start. then, you can view it in the browser. http://youhost/ If it is normal, the installation is successful. Set apache as a linux service cp/usr/local/apache2/bin/apachectl/etc/init. d/httpdvi/etc/init. d/httpd in #! Add the following two lines after/bin/sh # chkconfig: 345 85 15 # description: Start and stops the Apache HTTP Server. then chmod + x/etc/rc. d/init. d/httpdchkconfig-add httpd www.2cto.com 4. install PHP (1) tar zvxf php-5.2.10.tar.bz2 (2) cd php-5.2.10 (3 ). /configure-prefix =/usr/local/php-with-config-file-path =/usr/local/php/etc-with-mysql =/usr/local/mysql- with-mysqli =/usr/local/mysql/bin/mysql_config-with-iconv-dir =/usr/local-with-f Reetype-dir-with-jpeg-dir-with-png-dir-with-zlib-with-libxml-dir =/usr-enable-xml-disable-rpath-enable-discard -path-enable-safe-mode-enable-bcmath-enable-shmop-enable-sysvsem-enable-inline-optimization-with-curl-with-curlwrappers-enable-mbregex-enable -fastcgi-enable-fpm-enable-force-cgi-redirect-enable-mbstring-with-mcrypt-with-gd-enable-gd-native-ttf-with-openssl- -mhash -Enable-pcntl-enable-sockets-with-ldap-sasl -- with-apxs2 =/usr/local/apache/bin/apxs www.2cto.com (4) make (5) make install the following error is reported when you restart apache in the last step: httpd: Syntax error on line 53 of/usr/local/apache/conf/httpd. conf: Cannot load/usr/local/apache/modules/libphp5.so into server:/usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied reason: is that Linux has a SELin Caused by the ux protection mode. Solution: www.2cto.com 1. how to disable SELINUX: vi/etc/selinux/config change SELINUX = enforcing to SELINUX = disabled. restarting this method may cause risks to the server. 2. do not disable SELINUX: run the following commands in sequence # setenforce 0 # chcon-c-v-R-u system_u-r object_r-t textrel_shlib_t/usr/local/apache/modules/libphp5.so # service httpd restart # setenforce 1 vi/usr/local/apache/conf/httpd. conf: add AddType application/x-httpd-php in this range. phpAddType application/x-httpd-php-source. phps although cpopy php configuration file cp .. // php-5.2.10/php. ini. dist/usr/local/php/lib/php. ini www.2cto.com modify php. ini file regi Ster_globals = On OK! Restart the apache server/usr/local/apache/bin/apachectl restart and write a php test page info. php: the content is as follows: If it is normal, you should be able to see the php information. Congratulations on your Apche + Mysql + PHP installation. By GUMINCONG

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.