轻量级java web实践-10(部署-三方软件)

部分软件需要安装,比如mysql,nginx

jdk略过,下载解压即可用。

mysql我使用percona server编译安装,如下:

    1、下载

wget -c http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.36-34.0/source/tarball/percona-server-5.5.36-34.0.tar.gz


    2、安装到指定目录

   

##解压
tar -zxvf percona-server-5.5.36-34.0.tar.gz
cd percona-server-5.5.36-34.0

cmake . \
  -DCMAKE_BUILD_TYPE:STRING=Release             \
  -DSYSCONFDIR:PATH=/maca/mysql            \
  -DCMAKE_INSTALL_PREFIX:PATH=/maca/mysql    \
  -DENABLED_PROFILING:BOOL=ON                   \
  -DENABLE_DEBUG_SYNC:BOOL=OFF                  \
  -DMYSQL_DATADIR:PATH=/maca/mysql/data        \
  -DMYSQL_MAINTAINER_MODE:BOOL=OFF              \
  -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,gb2312  \
  -DWITH_SSL:STRING=bundled                     \
  -DWITH_UNIT_TESTS:BOOL=OFF                    \
  -DWITH_ZLIB:STRING=bundled                    \
  -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON       \
  -DINSTALL_LAYOUT:STRING=STANDALONE            \
  -DCOMMUNITY_BUILD:BOOL=ON                     \
  -LH


  开始编译和安装
make
make install


$ cp /maca/mysql/support-files/my-large.cnf /mysql/my.cnf
修改my.cnf

mkdir /maca/mysql/logs

useradd mysql

#安装数据
$ /maca/mysql/scripts/mysql_install_db --defaults-file=/maca/mysql/my.cnf --basedir=/maca/mysql --user=mysql --datadir=/maca/mysql/data

chown mysql.mysql -R /maca/mysql/

启动
/maca/mysql/bin/mysqld_safe --defaults-file=/maca/mysql/my.cnf --user=mysql &  
#启动mysql,看是否成功  
netstat -tnl|grep 3306  

停止
$ /maca/mysql/bin/mysqladmin –uroot –piread shutdown


把mysql注册成服务
cp /maca/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod a+x /etc/rc.d/init.d/mysqld
chkconfig --add mysqld

启动,停止
service mysqld start


Nginx编译安装,安装到指定目录

nginx之前要安装PCRE
wget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz
tar -zxvf pcre-8.34.tar.gz
cd pcre-8.34

./configure
make && make install


nginx编译安装
1)下载
$wget -c http://nginx.org/download/nginx-1.4.6.tar.gz

2)解压
$tar -xzvf nginx-1.4.6.tar.gz

3)编译
$cd nginx-1.4.6

./configure --user=www --group=www \
--prefix=/maca/nginx \
--sbin-path=/maca/nginx/sbin/nginx \
--conf-path=/maca/nginx/conf/nginx.conf \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-pcre \
--lock-path=/var/run/nginx.lock \
--pid-path=/var/run/nginx.pid

make && make install

启动
#/maca/nginx/sbin/nginx -c /maca/nginx/conf/nginx.conf

停止
kill -QUIT pid


启动报错处理
/sbin/nginx: error while loading shared libraries: libpcre.so.1:
ln -s /usr/local/lib/libpcre.so.1 /lib64


你可能感兴趣的:(轻量级java web实践-10(部署-三方软件))