歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

環境搭建ubuntu 12.04 + nginx + Percona5.6.12

環境搭建ubuntu 12.04 + nginx + Percona5.6.12   1 ###搭建測試環境###   001 #設置root密碼 002 sudo passwd root 003 #切換root 004 su root 005 #不知道為什麼,換了源之後竟然連不上,無奈使用默認,誰告訴我原因? 006 gedit /etc/apt/sources.list 007 apt-get update 008 apt-get remove -y apache2 apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-common mysql-client mysql-server php5 php5-fpm pure-ftpd pure-ftpd-common pure-ftpd-mysql 009 apt-get -y autoremove 010   011 apt-get install -y gcc g++ make autoconf libltdl-dev libgd2-xpm-dev libfreetype6 libfreetype6-dev libxml2-dev libjpeg-dev libpng12-dev libcurl4-openssl-dev libssl-dev patch libmcrypt-dev libmhash-dev libncurses5-dev  libreadline-dev bzip2 libcap-dev ntpdate chkconfig diffutils sendmail iptables unzip 012   013 #####64位 014 ln -s /usr/lib/x86_64-linux-gnu/libpng* /usr/lib/ 015 ln -s /usr/lib/x86_64-linux-gnu/libjpeg* /usr/lib/ 016 #####32位 017 ln -s /usr/lib/i386-linux-gnu/libpng* /usr/lib/ 018 ln -s /usr/lib/i386-linux-gnu/libjpeg* /usr/lib/ 019   020 #########同步時間 021 ntpdate tiger.sina.com.cn 022 hwclock -w 023   024 mkdir -p /data0/www/ php程序路徑 025 mkdir -p /data0/soft/ 下載安裝包路徑 026 mkdir -p /data0/service/etc/ 配置文件夾 027 mkdir -p /data0/service/ 環境安裝路徑 028 mkdir -p /data0/service/init.d/ 啟動程序路徑 029 mkdir -p /data0/datas/mysql_data/ 數據存放目錄 030   031 ############ 032 /etc/init.d/apparmor stop 033 update-rc.d -f apparmor remove 034 apt-get remove -y apparmor apparmor-utils 035 ###簡單添加下用戶 036 groupadd mysql 037 useradd -g mysql mysql 038   039 groupadd www 040 useradd -g www www 041   042 ####################安裝Percona-Server 043 #下載cmake 044 tar zxvf cmake...tar.gz 045 ./bootstrap 046 make 047 make install 048 apt-get install bison //缺少兩個包,下面cmake會執行錯誤 049   050 tar zxvf Percona-Server-5.6.12.rc.tar.gz 051 cd Percona.... 052   053 #cmake . -LH 查看有那寫可以選擇的編譯參數 054 ####換行的時候需不需要 -?? 忘了,囧 055 cmake .\ 056  -DCMAKE_BUILD_TYPE:STRING:STRING=Release \ 057  -DSYSCONFDIR:PATH=/data0/service/Percona-Server-5.6.12    \ 058  -DCMAKE_INSTALL_PREFIX:PATH=/data0/service/Percona-Server-5.6.12 \ 059  -DENABLED_PROFILING:BOOL=ON \ 060  -DENABLE_DEBUG_SYNC:BOOL=OFF \ 061  -DMYSQL_DATADIR:PATH=/data0/datas/mysql_data \ 062  -DMYSQL_MAINTAINER_MODE:BOOL=OFF  \ 063  -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,gb2312 \ 064  -DWITH_SSL:STRING=bundled \ 065  -DWITH_UNIT_TESTS:BOOL=OFF \ 066  -DWITH_ZLIB:STRING=bundled \ 067  -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON \ 068  -DINSTALL_LAYOUT:STRING=STANDALONE \ 069  -DCOMMUNITY_BUILD:BOOL=ON \ 070  -LH 071   072 make 073   074 make install 075   076 ln -sf /data0/service/Percona-Server-5.6.12 /data0/service/mysql 077   078 cp support-files/my-default.cnf /data0/service/etc/my.cnf 079 ln -sf /data0/service/etc/my.cnf /etc/my.cnf 080   081 cp support-files/mysql.server /data0/service/init.d/mysqld 082 chmod 755 /data0/service/init.d/mysqld 083 ln -sf /data0/service/init.d/mysqld /etc/init.d/mysqld 084   085 echo "/data0/service/mysql/lib/" >> /etc/ld.so.conf 086 ldconfig 087   088   089 chown -R mysql.mysql /data0/datas/mysql_data/ 090   091 chmod 700 /data0/soft/Percona-Server-5.6.12-rc60.4/scripts/mysql_install_db 092 /data0/soft/Percona-Server-5.6.12-rc60.4/scripts/mysql_install_db --user=mysql --basedir=/data0/service/Percona-Server-5.6.12 --datadir=/data0/datas/mysql_data/ 093   094   095 /data0/service/mysql/bin/mysqladmin -u root password "123456" 096   097 /data0/service/mysql/bin/mysql -uroot -p"123456" -e"use mysql;update user set password=password('123456') where user='root';delete from user where user='';drop user ''@'%';flush privileges;" 098 ##啟動下 099 service mysqld start 100   101 ################################安裝nginx 102 #先裝pcre 103 tar zxvf pcre-8.10.tar.gz 104 cd pcre-8.10 105 ./configure --prefix=/usr 106 make 107 make install 108   109 ###自行替換*號 110 tar zxvf nginx-****.tar.gz 111 cd nginx*** 112 make clean 113 ./configure --user=www --group=www --prefix=/data0/service/nginx-**** --with-http_stub_status_module --with-http_ssl_module 114   115 make && make install 116   117 ln -sf /data0/service/nginx-***** /data0/service/nginx 118 mkdir /data0/service/nginx/conf/vhost 119 mkdir /data0/service/nginx/conf/rewrite 120 mkdir -p /data0/www/default 121 ###網站的log就放在這了,記得自己改配置 122 mkdir -p /data0/www_logs 123   124 chown -R www.www /data0/www/ 125   126 ###下面幾個配置文件,我就不發了,有需要的話再貼上來 127 cp ****/fcgi.conf /data0/service/nginx/conf/fcgi.conf 128 cp ****/nginx.conf /data0/service/nginx/conf/nginx.conf 129 cp ****/default.conf /data0/service/nginx/conf/vhost/000.default.conf 130 cp ****/init.nginxd /data0/service/init.d/nginxd 131   132 chmod 755 /data0/service/init.d/nginxd 133 rm -f /etc/init.d/nginxd 134 ln -sf /data0/service/init.d/nginxd /etc/init.d/nginxd 135   136 #記得要寫好nginxd  nginx.conf default.conf 的配置 137 #啟動下 138 service nginxd start 139 #########################################安裝php5.5 140 ####libiconv 141 tar zxvf libiconv-1.14.tar.gz 142 cd libiconv-1.14 143 ./configure --prefix=/usr 144 make 145 make install 146 ldconfig 147   148 tar zxvf php-5.5.1.tar.gz 149   150 ###忘了這裡操作了沒有... 151 #64 152 #ln -s /usr/lib/x86_64-linux-gnu/libssl.* /usr/lib/ 153 #32 154 ln -s /usr/lib/i386-linux-gnu/libssl.* /usr/lib/ 155 ####忘了....囧 156   157 cd php-5.5.1 158 #####編譯的時候發現少了很多包,郁悶,這塊用了很長時間,此奧! 159 apt-get install postgresql 160 apt-get install install postgresql-9.1 postgresql-client-9.1 postgresql-client-common postgresql-common postgresql-server-dev-9.1 161 apt-get install libxslt-dev 162   163 ##去掉了--with-tidy=選項 因為沒搞定這個tidy.... 剛開始忘記fpm了...囧   164 ./configure --enable-opcache --prefix=/data0/service/php-5.5.1 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pgsql=/usr  --with-curl --with-openssl-dir --with-zlib-dir=/usr --with-xpm-dir=/usr --with-pdo-pgsql=/usr --with-pdo-mysql=mysqlnd --with-xsl=/usr --with-ldap --with-xmlrpc --with-iconv-dir=/usr --with-snmp=/usr --enable-exif --enable-calendar --with-bz2=/usr --with-mcrypt=/usr --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --enable-mbstring --enable-zip --with-pear --with-libdir=/lib/i386-linux-gnu --with-config-file-path=/data0/service/etc --enable-fpm 165   166 make ZEND_EXTRA_LIBS='-liconv' 167   168 make install 169   170 ln -sf /data0/service/php-5.5.1 /data0/service/php 171 ###選好用那個  php.ini文件 172 cp  php.ini-development   /data0/service/php/etc/php.ini 173 ln -sf /data0/service/etc /data0/service/php/etc/php.ini 174   175 cd /data0/service/php/etc/ 176 cp php-fpm.conf.default php-fpm.conf  177 vim php-fpm.conf  178 // 找到如下幾行,確保如下幾行前沒有";"  179 pid = run/php-fpm.pid  180 error_log = log/php-fpm.log  181 listen = 127.0.0.1:9000  182 pm.max_children = 50  183 pm.start_servers = 20  184 pm.min_spare_servers = 5  185 pm.max_spare_servers = 35  186 pm.max_requests = 500 187 #記得修改下這兩個值 188 user = www 189 group = www 190   191   192 cp /data0/soft/php-5.5.1/sapi/fpm/init.d.php-fpm /data0/service/init.d/php-fpm 193 chmod 755 /data0/service/init.d/php-fpm 194 ln -sf /data0/service/init.d/php-fpm /etc/init.d/php-fpm 195   196 vim php.ini 197 修改:extension="/data0/service/php-5.5.1/lib/php/extensions/no-debug-non-zts-20121212/" 198   199 ######搞定,收工 200 service mysqld restart 201 service php-fpm start 202 service nginxd restart 203   204   205 ############################################## 206 #            反正我是成功了~  舒坦~             # 207 ##############################################  
Copyright © Linux教程網 All Rights Reserved