Ubuntu14.04-LAMP环境搭建

直接上代码吧

sudo apt-get -y updatesudo apt-get -y autoremove apache2 nginx php5 mysql-serversudo apt-get -y install unzip build-essential libncurses5-dev libfreetype6-dev libxml2-dev libssl-dev libcurl4-openssl-dev libjpeg62-dev libpng12-dev libfreetype6-dev libsasl2-dev libpcre3-dev autoconf libperl-dev libtool libaio*sudo userdel wwwsudo groupadd wwwsudo useradd -g www -M -d /wuye/www -s /usr/sbin/nologin wwwsudo mkdir -p /wuyesudo mkdir -p /wuye/serversudo mkdir -p /wuye/server/httpdsudo mkdir -p /wuye/logsudo mkdir -p /wuye/log/phpsudo mkdir -p /wuye/log/mysqlsudo mkdir -p /wuye/wwwsudo chown -R www:www /wuye/log# http://ftp.gnu.org/pub/gnu/libiconv/cd /usr/src/sudo wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gzsudo tar -xzvf libiconv-1.13.1.tar.gzcd libiconv-1.13.1/sudo ./configure --prefix=/usr/localsudo make -j4sudo make install# http://zlib.net/zlib-1.2.8.tar.gzcd /usr/src/sudo wget http://oss.aliyuncs.com/aliyunecs/onekey/zlib-1.2.3.tar.gzsudo tar -xzvf zlib-1.2.3.tar.gzcd zlib-1.2.3/sudo ./configure sudo make -j4sudo make install# http://download.savannah.gnu.org/releases/freetype/cd /usr/src/sudo wget http://oss.aliyuncs.com/aliyunecs/onekey/freetype-2.1.10.tar.gzsudo tar -xzvf freetype-2.1.10.tar.gzcd freetype-2.1.10/sudo ./configure --prefix=/usr/local/freetype.2.1.10sudo make -j4sudo make install # http://www.libpng.org/pub/png/libpng.htmlcd /usr/src/sudo wget http://oss.aliyuncs.com/aliyunecs/onekey/libpng-1.2.50.tar.gzsudo tar -xzvf libpng-1.2.50.tar.gz cd libpng-1.2.50/sudo ./configure --prefix=/usr/local/libpng.1.2.50sudo make -j4sudo make install# http://libevent.org/cd /usr/src/sudo wget http://oss.aliyuncs.com/aliyunecs/onekey/libevent-1.4.14b.tar.gzsudo tar -xzvf libevent-1.4.14b.tar.gz cd libevent-1.4.14b/sudo ./configure sudo make -j4sudo make install# https://sourceforge.net/projects/mcrypt/cd /usr/src/sudo wget http://oss.aliyuncs.com/aliyunecs/onekey/libmcrypt-2.5.8.tar.gzsudo tar -xzvf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8/sudo ./configure --disable-posix-threadssudo make -j4sudo make install# pwd# /usr/src/libmcrypt-2.5.8sudo /sbin/ldconfigcd libltdl/sudo ./configure --enable-ltdl-installsudo makesudo make install# http://www.pcre.org/cd /usr/srcsudo wget http://oss.aliyuncs.com/aliyunecs/onekey/pcre-8.12.tar.gzsudo tar -xzvf pcre-8.12.tar.gz cd pcre-8.12/sudo ./configure sudo make sudo make install# cd /usr/srcsudo wget http://oss.aliyuncs.com/aliyunecs/onekey/jpegsrc.v6b.tar.gzsudo tar -xzvf jpegsrc.v6b.tar.gz cd jpeg-6b/sudo cp /usr/share/libtool/config/config.guess .sudo cp /usr/share/libtool/config/config.sub .sudo ./configure --prefix=/usr/local/jpeg.6 --enable-shared --enable-staticsudo mkdir -p /usr/local/jpeg.6/includesudo mkdir -p /usr/local/jpeg.6/libsudo mkdir -p /usr/local/jpeg.6/binsudo mkdir -p /usr/local/jpeg.6/man/man1sudo make -j4sudo make install-libsudo make installcd /usr/srcsudo touch /etc/ld.so.conf.d/usrlib.confecho "/usr/local/lib" > /etc/ld.so.conf.d/usrlib.conf# mysqlsudo userdel mysqlsudo groupadd mysqlsudo useradd -g mysql -s /sbin/nologin mysqlcd /wuye/serversudo wget http://zy-res.oss-cn-hangzhou.aliyuncs.com/mysql/mysql-5.6.21-linux-glibc2.5-x86_64.tar.gzsudo tar -xzvf mysql-5.6.21-linux-glibc2.5-x86_64.tar.gzsudo mv mysql-5.6.21-linux-glibc2.5-x86_64/ mysql-5.6.21sudo ln -s mysql-5.6.21/ mysqlsudo /wuye/server/mysql/scripts/mysql_install_db --user=mysql --datadir=/wuye/server/mysql/data/ --basedir=/wuye/server/mysqlsudo chown -R mysql:mysql /wuye/server/mysql/sudo chown -R mysql:mysql /wuye/server/mysql/data/sudo chown -R mysql:mysql /wuye/log/mysqlsudo cp /wuye/server/mysql/support-files/mysql.server /etc/init.d/mysqldsudo sed -i 's# ^basedir=$# basedir=/wuye/server/mysql# ' /etc/init.d/mysqldsudo sed -i 's# ^datadir=$# datadir=/wuye/server/mysql/data# ' /etc/init.d/mysqldsudo vim /etc/my.cnf    [client]                                                      port   = 3306    socket = /tmp/mysql.sock    [mysqld]    port   = 3306    socket = /tmp/mysql.sock    skip-external-locking    log-error               = /wuye/log/mysql/error.log    key_buffer_size         = 16M    max_allowed_packet      = 1M    table_open_cache        = 64    sort_buffer_size        = 512K    net_buffer_length       = 8K    read_buffer_size        = 256K    read_rnd_buffer_size    = 512K    myisam_sort_buffer_size = 8M    log-bin       = mysql-bin    binlog_format = mixed    server-id     = 1    sql_mode      = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES    [mysqldump]    quick    max_allowed_packet = 16M    [mysql]    no-auto-rehash    [myisamchk]    key_buffer_size  = 20M    sort_buffer_size = 20M    read_buffer      = 2M    write_buffer     = 2M    [mysqlhotcopy]    interactive-timeout    expire_logs_days = 5    max_binlog_size  = 1000M:wqsudo chmod 755 /etc/init.d/mysqldsudo /etc/init.d/mysqld start# http://www.apache.org/cd /usr/src/sudo wget http://zy-res.oss-cn-hangzhou.aliyuncs.com/httpd/httpd-2.4.10.tar.gzsudo tar -xzvf httpd-2.4.10.tar.gzsudo wget http://oss.aliyuncs.com/aliyunecs/onekey/apache/apr-1.5.0.tar.gzsudo tar -xzvf apr-1.5.0.tar.gz sudo cp -rf apr-1.5.0 httpd-2.4.10/srclib/aprsudo wget http://oss.aliyuncs.com/aliyunecs/onekey/apache/apr-util-1.5.3.tar.gztar -xzvf apr-util-1.5.3.tar.gz sudo tar -xzvf apr-util-1.5.3.tar.gz sudo cp -rf apr-util-1.5.3 httpd-2.4.10/srclib/apr-utilcd httpd-2.4.10/sudo ./configure --prefix=/wuye/server/httpd --with-mpm=prefork --enable-so --enable-rewrite --enable-mods-shared=all --enable-nonportable-atomics=yes --disable-dav --enable-deflate --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-ssl --with-included-apr --enable-modules=all --enable-mods-shared=all --with-ssl=/usr/local/opensslsudo make -j4sudo make installsudo cp support/apachectl /etc/init.d/httpdsudo chmod u+x /etc/init.d/httpdcd /wuye/server/httpd/conf/sudo cp httpd.conf httpd.conf.baksed -i "s;# LoadModule rewrite_module modules/mod_rewrite.so;LoadModule rewrite_module modules/mod_rewrite.so\nLoadModule php5_module modules/libphp5.so;" httpd.confsudo sed -i "s;# LoadModule rewrite_module modules/mod_rewrite.so;LoadModule rewrite_module modules/mod_rewrite.so\nLoadModule php5_module modules/libphp5.so;" httpd.confsudo sed -i "s# User daemon# User www# " httpd.confsudo sed -i "s# Group daemon# Group www# " httpd.confsudo sed -i "s;# ServerName www.example.com:80;ServerName www.example.com:80;" httpd.confsudo sed -i "s# /wuye/server/httpd/htdocs# /wuye/www# " httpd.confsudo sed -i "s### " httpd.confsudo sed -i "s# AllowOverride None# AllowOverride all# " httpd.confsudo sed -i "s# DirectoryIndex index.html# DirectoryIndex index.html index.htm index.php# " httpd.confsudo sed -i "s;# Include conf/extra/httpd-mpm.conf;Include conf/extra/httpd-mpm.conf;" httpd.confsudo sed -i "s;# Include conf/extra/httpd-vhosts.conf;Include conf/extra/httpd-vhosts.conf;" httpd.confecho "HostnameLookups off" >> httpd.confecho "AddType application/x-httpd-php .php" >> httpd.confecho "Include /wuye/server/httpd/conf/vhosts/*.conf" > /wuye/server/httpd/conf/extra/httpd-vhosts.confsudo mkdir -p /wuye/server/httpd/conf/vhosts/cd /wuye/server/httpd/conf/vhosts/sudo vim wuye.conf    Order allow,deny    Deny from all    DocumentRoot /wuye/www/coding    ServerName localhost    ServerAlias localhost    Options Indexes FollowSymLinks    AllowOverride all    Order allow,deny    Allow from all    RewriteEngine On    RewriteRule ^(.*)-htm-(.*)$ $1.php?$2    RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2    ErrorLog "/wuye/log/httpd/coding-error.log"    CustomLog "/wuye/log/httpd/coding.log" common:wqcd /wuye/server/httpd/conf/extra/sudo sed -i 's/StartServers             5/StartServers            10/g' httpd-mpm.confsudo sed -i 's/MinSpareServers          5/MinSpareServers         10/g' httpd-mpm.confsudo sed -i 's/MaxSpareServers         10/MaxSpareServers         30/g' httpd-mpm.confsudo sed -i 's/MaxRequestWorkers      150/MaxRequestWorkers      255/g' httpd-mpm.confcd /wuye/wwwsudo mkdir codingcd codingsudo vim index.php# 解决 /usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC# /usr/local/lib/libz.a: error adding symbols: Bad value# collect2: error: ld returned 1 exit statuscd /usr/src/zlib-1.2.3/sudo CFLAGS="-O3 -fPIC" ./configuresudo makesudo make install# 解决/usr/bin/ld: /usr/local/openssl/lib/libssl.a(s3_srvr.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC# /usr/local/openssl/lib/libssl.a: error adding symbols: Bad value# collect2: error: ld returned 1 exit statuscd /usr/src/sudo wget  http://t-down.oss-cn-hangzhou.aliyuncs.com/openssl-1.0.1h.tar.gzsudo tar -xzvf openssl-1.0.1h.tar.gz cd openssl-1.0.1h/mv /usr/local/ssl /usr/local/ssl.OFFsudo ./config -fPIC no-gost no-shared no-zlibsudo make -j4sudo make installsudo mv /usr/bin/openssl /usr/bin/openssl.OFFsduo mv /usr/include/openssl /usr/include/openssl.OFFsudo mv /usr/include/openssl /usr/include/openssl.OFFsudo ln -s /usr/local/ssl/bin/openssl /usr/bin/opensslsudo ln -s /usr/local/ssl/include/openssl /usr/include/opensslecho "/usr/local/ssl/lib" >> /etc/ld.so.conf# 判断下有了则不添加sudo ldconfig -vsudo openssl version -a# php-5.5.7cd /usr/src/sudo wget http://oss.aliyuncs.com/aliyunecs/onekey/php/php-5.5.7.tar.gzsudo wget http://oss.aliyuncs.com/aliyunecs/onekey/php/php-5.5.7.tar.gzcd php-5.5.7/sudo ./configure --prefix=/wuye/server/php --enable-opcache --with-config-file-path=/wuye/server/php/etc --with-apxs2=/wuye/server/httpd/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-static --enable-maintainer-zts --enable-zend-multibyte --enable-inline-optimization --enable-sockets --enable-wddx --enable-zip --enable-calendar --enable-bcmath --enable-soap --with-zlib --with-iconv --with-gd --with-xmlrpc --enable-mbstring --without-sqlite --with-curl --enable-ftp --with-mcrypt  --with-freetype-dir=/usr/local/freetype.2.1.10 --with-jpeg-dir=/usr/local/jpeg.6 --with-png-dir=/usr/local/libpng.1.2.50 --disable-ipv6 --disable-debug --with-openssl --disable-maintainer-zts --disable-safe-mode --disable-fileinfo --enable-pcntlsudo make ZEND_EXTRA_LIBS='-liconv' -j4sudo make installsudo /etc/init.d/httpd start# php-7.0.8cd /usr/srcsudo wget http://be2.php.net/get/php-7.0.8.tar.bz2/from/this/mirrorsudo tar -xjvf php-7.0.8.tar.bz2cd php-7.0.8/sudo ./configure --prefix=/usr/local/php7 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-static --enable-maintainer-zts --enable-zend-multibyte --enable-inline-optimization --enable-sockets --enable-wddx --enable-zip --enable-calendar --enable-bcmath --enable-soap --with-zlib --with-iconv --with-gd --with-xmlrpc --enable-mbstring --without-sqlite --with-curl --enable-ftp --with-mcrypt  --with-freetype-dir=/usr/local/freetype.2.1.10 --with-jpeg-dir=/usr/local/jpeg.6 --with-png-dir=/usr/local/libpng.1.2.50 --disable-ipv6 --disable-debug --with-openssl --disable-maintainer-zts --disable-safe-mode --disable-fileinfo --enable-pcntlsudo make ZEND_EXTRA_LIBS='-liconv' -j4sudo make install

关键字:ubuntu, Apache, mysql, php


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部