`
yaozhan189
  • 浏览: 49605 次
  • 性别: Icon_minigender_1
  • 来自: 宁波
社区版块
存档分类
最新评论

部署。8服务器

阅读更多


1. 安装svn
cd /data/software/temp
tar xfvz subversion-1.6.5.tar.gz
tar xfvz subversion-deps-1.6.5.tar.gz
cd subversion-1.6.5
./configure --prefix=/data/software/svn
make && make install

ln -s -f /data/software/svn/bin/svnadmin /usr/bin/svnadmin
ln -s -f /data/software/svn/bin/svnserve /usr/bin/svnserve
ln -s -f /data/software/svn/bin/svn /usr/bin/svn

svnserve --version

unzip svn.zip -d /data/svn
把压缩包解压到/data/svn

svnserve -d -r /data/svn --listen-port 3690

vi /etc/rc.d/rc.local
svnserve -d -r /data/svn --listen-port 3690





2. 安装jdk
cd /data/software/temp
chmod +x jdk-6u18-linux-i586-rpm.bin
./jdk-6u18-linux-i586-rpm.bin

vi /etc/profile
#set java
JAVA_HOME=/usr/java/jdk1.6.0_18
CLASSPATH=.:$JAVA_HOME/lib
JRE_HOME=$JAVA_HOME/jre
export JAVA_HOME CLASSPATH JRE_HOME





3. 安装ant
cd /data/software/temp
tar -zxvf apache-ant-1.8.1-bin.tar.gz -C /data/software

vi /etc/profile
#set ant
export ANT_HOME=/data/software/apache-ant-1.8.1
export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin

source /etc/profile

ln -s -f /data/software/apache-ant-1.8.1/bin/ant /usr/bin/ant






4. 安装ImageMagick和JMagick
先安装各种字库
yum -y install autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

安装ImageMagick
cd /data/software/temp
tar -zxvf ImageMagick-6.4.0-0.tar.gz
cd ImageMagick-6.4.0
./configure --prefix=/data/software/ImageMagick-6.4.0 --enable-share --enable-static
Host system type : i686-pc-linux-gnu
                  Option                        Value
-------------------------------------------------------------------------
Shared libraries --enable-shared=yes           yes
Static libraries --enable-static=yes           yes
Module support    --with-modules=no             no
GNU ld            --with-gnu-ld=yes             yes
Quantum depth     --with-quantum-depth=16       16
Delegate Configuration:

BZLIB             --with-bzlib=yes              yes    检查

DPS               --with-dps=yes                no
FlashPIX          --with-fpx=no         no

FreeType 2.0      --with-ttf=yes                yes    检查

GhostPCL          None                          pcl6 (unknown)
Ghostscript       None                          gs (7.07)
Ghostscript fonts --with-gs-font-dir=default    /usr/share/fonts/default/Type1/
Ghostscript lib   --with-gslib=no               no
Graphviz          --with-gvc=yes                no
JBIG              --with-jbig=yes               no

JPEG v1           --with-jpeg=yes               no     检查

JPEG-2000         --with-jp2=yes                no
LCMS              --with-lcms=yes               no
Magick++          --with-magick-plus-plus=yes   yes
PERL              --with-perl=yes               /usr/bin/perl

PNG               --with-png=yes                yes    检查

TIFF              --with-tiff=yes               no
Windows fonts     --with-windows-font-dir=      none
WMF               --with-wmf=yes                no
X11               --with-x=                     no
XML               --with-xml=yes                yes

ZLIB              --with-zlib=yes               yes    检查

注意:::
特别检查 BZLIB, FreeType, JPEG v1, JPEG-2000, PNG, ZLIB
make && make install
ln -s -f /data/software/ImageMagick-6.4.0/bin/convert /usr/bin/convert
检查:convert -sample 25%x25% /data/input.jpg /data/output.jpg

安装JMagick
cd /data/software/temp
tar -zxvf jmagick-6.4.0-src.tar.gz -C /data/software
cd /data/software/6.4.0
./configure --with-java-home=/usr/java/jdk1.6.0_18 --with-magick-home=/data/software/ImageMagick-6.4.0 --enable-share --enable-static
make all && make install
cp lib/libJMagick.so /usr/java/jdk1.6.0_18/jre/lib/i386/







5. 安装mysql(用于bugfree,端口3306)


cd /data/software/temp
tar -zxvf mysql-5.1.34-linux-i686-icc-glibc23.tar.gz -C /data/software
cd /data/software
mv mysql-5.1.34-linux-i686-icc-glibc23 mysql_3306
cd mysql_3306
scripts/mysql_install_db
groupadd mysql
useradd -g mysql mysql
cp /data/software/mysql_3306/support-files/mysql.server /etc/init.d/mysql_3306

vi /etc/init.d/mysql_3306
修改其中
basedir=/data/software/mysql_3306
Datadir=/data/software/mysql_3306/data

cd /data/software/mysql_3306
chown -R root.root .
chgrp -R mysql .
chown -R mysql ./data

vi my.cnf
把mysql_3306的内容粘贴进去

# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql/data) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password    = your_password
port        = 3306
socket        = /tmp/mysql_3306.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
basedir         = /data/software/mysql_3306
datadir         = /data/software/mysql_3306/data
port        = 3306
socket        = /tmp/mysql_3306.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (using the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
server-id    = 1

# Uncomment the following if you want to log updates
#log-bin=mysql-bin

# binary logging format - mixed recommended
#binlog_format=mixed

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql/data/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout

#-----------------------------------------end----------------------------------

chmod 755 my.cnf

service mysql_3306 start
chkconfig --add mysql_3306

cd bin
./mysqladmin -uroot password "123456" -S /tmp/mysql_3306.sock
./mysql -uroot -p123456 -S /tmp/mysql_3306.sock
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql> use mysql;
mysql> delete from user where password="";
mysql> create database bugfree2;
mysql> use bugfree2;
mysql> source /data/bugfree2.sql
mysql> flush privileges;
mysql> exit;


Navicat连接数据库,并把表名的小写改成大写,
bf_buginfo 改成 bf_BugInfo
bf_caseinfo 改成 bf_CaseInfo
bf_requireinfo 改成 bf_RequireInfo
bf_resultinfo 改成 bf_ResultInfo
bf_testaction 改成 bf_TestAction
bf_testfile 改成 bf_TestFile
bf_testgroup 改成 bf_TestGroup
bf_testhistory 改成 bf_TestHistory
bf_testmodule 改成 bf_TestModule
bf_testoptions 改成 bf_TestOptions
bf_testproject 改成 bf_TestProject
bf_testuser 改成 bf_TestUser
bf_testuserlog 改成 bf_TestUserLog
bf_testuserquery 改成 bf_TestUserQuery
 





6. 安装TCMalloc
cd /data/software/temp
tar -zxvf google-perftools-1.5.tar.gz
cd google-perftools-1.5
./configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig

vi /data/software/mysql_3306/bin/mysqld_safe
在# executing mysqld_safe的下一行,加上:
export LD_PRELOAD=/usr/local/lib/libtcmalloc.so

service mysql_3306 restart

使用lsof命令查看tcmalloc是否起效:
lsof -n | grep tcmalloc

如果发现以下信息,说明tcmalloc已经起效:
mysqld    10847   mysql  mem       REG        8,5  1203756   20484960 /usr/local/lib/libtcmalloc.so.0.0.0 






7. 安装apache
cd /data/software/temp
tar -zxvf httpd-2.2.15.tar.gz
cd httpd-2.2.15
./configure --prefix=/data/software/apache2 --enable-so  --enable-dav --enable-dav-fs --enable-mods-shared=most
make && make install

groupadd apache
useradd -g apache apache





8. 安装php
cd /data/software/temp
tar -zxvf php-5.2.13.tar.gz
cd php-5.2.13
./configure --prefix=/data/software/php --with-apxs2=/data/software/apache2/bin/apxs --with-mysql=/data/software/mysql_3306
make && make install
cp php.ini-dist /usr/local/lib/php.ini


vi /data/software/apache2/conf/httpd.conf

Listen 80 改成 Listen 192.168.27.135:8080

#ServerName www.example.com:80 要改成 ServerName localhost:8080

用户和用户组改成
User apache
Group apache

<IfModule mime_module>  下面加一行  AddType application/x-httpd-php .php

把 Include conf/extra/httpd-vhosts.conf 的#注释去掉


<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
改成
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
index.html 后面加 index.php


修改虚拟主机配置文件

vi /data/software/apache2/conf/extra/httpd-vhosts.conf

NameVirtualHost 192.168.1.250:8080

<VirtualHost 192.168.1.250:8080>
        ServerName bug.jiaming.com
        DocumentRoot /data/bugfree
        ErrorLog /data/software/apache2/logs/bugfree.log
        TransferLog /data/software/apache2/logs/bugfree.log
</VirtualHost>

<VirtualHost 192.168.1.250:8080>
        ServerName admin.jiaming.com
        DocumentRoot /data/hisupplier.com/hisupplier-admin
        ErrorLog /data/software/apache2/logs/hisupplier-admin.log
        TransferLog /data/software/apache2/logs/hisupplier-admin.log
</VirtualHost>

解压bugfree的源程序
cd /data
unzip bugfree.zip
chown -R apache.apache /data/bugfree

修改数据库链接
vi /data/bugfree/Include/Config.inc.php

/* 3. Define the username and password of the BugFree database. */
$_CFG['DB']['User']        = 'root';
$_CFG['DB']['Password']    = '123456';
$_CFG['DB']['Host']        = '192.168.1.250';
$_CFG['DB']['Database']    = 'bugfree2';
$_CFG['DB']['TablePrefix'] = 'bf_';
$_CFG['DBCharset']         = 'UTF8';


检出英文版总后台
svn checkout svn://192.168.1.250/hisupplier-en/admin/branches/v3.2.1 /data/hisupplier.com/hisupplier-admin --username guest --password guest --non-interactive


把apache做成服务
cp /data/software/apache2/bin/apachectl /etc/init.d/httpd
chmod +x /etc/init.d/httpd

vi /etc/init.d/httpd
在 #!/bin/sh 后面加
# Linux startup script for Apache
# chkconfig: 345 85 15
# description: Apache is a Web server.
# processname: httpd

service httpd start
chkconfig --add httpd






11. 检出svn中的源程序 && 编译

vi /data/checkoutBuild.sh

#!/bin/bash

#----------------- 英文版 -----------------

svn checkout svn://192.168.1.250/hisupplier/app-lib /data/hisupplier.com/svn/app-lib --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier/cas/branches/v3.1 /data/hisupplier.com/svn/hisupplier-cas --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier/img/branches/v3.0 /data/hisupplier.com/svn/img-3.0 --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/hicc/branches/v3.0 /data/hisupplier.com/svn/hicc --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/b2b/branches/v3.5.0 /data/hisupplier.com/svn/hisupplier-b2b --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/account/branches/v3.5.1 /data/hisupplier.com/svn/hisupplier-account --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/tradeshow/branches/v3.3.0 /data/hisupplier.com/svn/hisupplier-tradeshow --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/goldsite/branches/v3.0 /data/hisupplier.com/svn/hisupplier-goldsite --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/manufacturer/branches/v3.0 /data/hisupplier.com/svn/hisupplier-manufacturer --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/trade/branches/v3.0 /data/hisupplier.com/svn/hisupplier-trade --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/city/branches/v1.0 /data/hisupplier.com/svn/hisupplier-city --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/wap/branches/v1.x /data/hisupplier.com/svn/hisupplier-wap --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/showroom/branches/v3.2.0 /data/hisupplier.com/svn/hisupplier-showroom --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-en/indie/branches/v4.0.0 /data/hisupplier.com/svn/hisupplier-indie --username guest --password guest --non-interactive
sleep 1

cd /data/hisupplier.com/svn/hisupplier-cas
ant test
sleep 1
cd /data/hisupplier.com/svn/img-3.0
ant test
sleep 1
cd /data/hisupplier.com/svn/hicc
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-b2b
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-account
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-tradeshow
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-goldsite
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-manufacturer
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-trade
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-city
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-wap
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-showroom
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-indie
ant test


#----------------- 中文版 -----------------

svn checkout svn://192.168.1.250/hisupplier/img/branches/v3.1 /data/hisupplier.com/svn/img-3.1 --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-cn/hicc/branches/v3.0 /data/hisupplier.com/svn/hisupplier-cn-hicc --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-cn/b2b/branches/v3.0.2 /data/hisupplier.com/svn/hisupplier-cn-b2b --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-cn/account/branches/v3.1.1 /data/hisupplier.com/svn/hisupplier-cn-account --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-cn/tradeshow/branches/v3.0.1 /data/hisupplier.com/svn/hisupplier-cn-tradeshow --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-cn/train/branches/v1.0 /data/hisupplier.com/svn/hisupplier-cn-train --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-cn/admin/branches/v3.1.1 /data/hisupplier.com/svn/hisupplier-cn-admin --username guest --password guest --non-interactive
sleep 1
svn checkout svn://192.168.1.250/hisupplier-cn/showroom/branches/v3.0.1 /data/hisupplier.com/svn/hisupplier-cn-showroom --username guest --password guest --non-interactive
sleep 1

cd /data/hisupplier.com/svn/img-3.1
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-cn-hicc
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-cn-b2b
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-cn-account
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-cn-tradeshow
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-cn-train
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-cn-admin
ant test
sleep 1
cd /data/hisupplier.com/svn/hisupplier-cn-showroom
ant test
sleep 1

#------------------------- end ------------------------


执行脚本:
chmod +x /data/checkoutBuild.sh
/data/checkoutBuild.sh






9. 安装resin
cd /data/software/temp
tar -zxvf resin-3.1.9.tar.gz
cd resin-3.1.9
./configure -with-java-home=/usr/java/jdk1.6.0_18 --prefix=/data/software/resin
make && make install


cd /data/software/temp
tar -zxvf resin-3.1.9.tar.gz
cd resin-3.1.9
./configure -with-java-home=/usr/java/jdk1.6.0_18 --prefix=/data/software/resin-3.1.9-en
make && make install

cd ..
rm -rf resin-3.1.9

tar -zxvf resin-3.1.9.tar.gz
cd resin-3.1.9
./configure -with-java-home=/usr/java/jdk1.6.0_18 --prefix=/data/software/resin-3.1.9-cn
make && make install


1). 把ext-lib拷贝到中英文的resin/lib目录下

2). 把预先设置好的conf文件贴进去
vi /data/software/resin/conf/resin.conf
vi /data/software/resin-3.1.9-en/conf/resin.conf
vi /data/software/resin-3.1.9-cn/conf/resin.conf

3). 把 resin resin-en resin-cn 三个文件拷贝到 /etc/init.d目录下面
chmod +x /etc/init.d/resin
chmod +x /etc/init.d/resin-en
chmod +x /etc/init.d/resin-cn

4). 拷贝开发好的svn自动更新程序
mkdir /data/hisupplier.com/svnUpdate
unzip svnUpdate.zip -d /data/hisupplier.com/svnUpdate

vi /data/hisupplier.com/svnUpdate/en.sh
vi /data/hisupplier.com/svnUpdate/cn.sh

把这个2个脚本贴进去

chmod +x /data/hisupplier.com/svnUpdate/en.sh
chmod +x /data/hisupplier.com/svnUpdate/cn.sh


chkconfig --add resin
chkconfig --add resin-en
chkconfig --add resin-cn

service resin start
service resin-en start
service resin-cn start





10. 安装nginx
cd /data/software/temp
tar -zxvf pcre-8.02.tar.gz
mv pcre-8.02 ../
cd /data/software/pcre-8.02
./configure
make && make install

cd /data/software/temp
tar -zxvf nginx-0.8.35.tar.gz
cd nginx-0.8.35
./configure  --user=root --group=root --prefix=/data/software/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module
make && make install

vi /data/software/nginx/conf/nginx.conf
把预先设置好的conf贴进去

启动nginx
/data/software/nginx/sbin/nginx
如果关闭,ps –aux|grep nginx,然后kill,如果平滑重启 kill -HUP

或者可以做成服务

vi /etc/init.d/nginx

#!/bin/bash
# Linux startup script for nginx
# chkconfig: 345 85 15
# description: Nginx HTTP Server.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /data/software/nginx/conf/nginx.conf

nginxd=/data/software/nginx/sbin/nginx
nginx_config=/data/software/nginx/conf/nginx.conf
nginx_pid=/data/software/nginx/logs/nginx.pid

RETVAL=0
prog="nginx"

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x $nginxd ] || exit 0


# Start nginx daemons functions.
start() {

if [ -e $nginx_pid ];then
   echo "nginx already running...."
   exit 1
fi

   echo -n $"Starting $prog: "
   daemon $nginxd -c ${nginx_config}
   RETVAL=$?
   echo
   [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
   return $RETVAL

}


# Stop nginx daemons functions.
stop() {
        echo -n $"Stopping $prog: "
        killproc $nginxd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}


# reload nginx service functions.
reload() {

    echo -n $"Reloading $prog: "
    #kill -HUP `cat ${nginx_pid}`
    killproc $nginxd -HUP
    RETVAL=$?
    echo

}

# See how we were called.
case "$1" in
start)
        start
        ;;

stop)
        stop
        ;;

reload)
        reload
        ;;

restart)
        stop
        start
        ;;

status)
        status $prog
        RETVAL=$?
        ;;
*)
        echo $"Usage: $prog {start|stop|restart|reload|status|help}"
        exit 1
esac

exit $RETVAL


# ============== the END =============


chmod +x /etc/init.d/nginx
service nginx start
chkconfig --add nginx

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics