以下安装所用的到资源请到http://download.csdn.net/detail/osyun/4421715下载。如果博客园给我开放大于30M的权限,我就将该包发到博客园上。
我使用的安装环境是rhel5.5。如果是其它系统的就别下那个包了,可以参考如下的离线安装方式去自己做一个。本文也只是为大家提供一个convirt离线安装的方式。在rhel5.5下,只保留gcc的情况下,该文档完全有效。因为在安装python2.6.5的时候需要用的gcc编译。
一、搭建本地的yum源
1.新建/yum文件夹,将光盘中的Server文件夹下的包全部拷贝到yum下
2.新建配置文件
#vi /etc/yum.repos.d/convirt.repo
[convirt]
name=ConVirt repository
baseurl=file:///yum
enabled=1
gpgcheck=0
将其它配置文件删除
3.修改vi /usr/lib/python2.4/site-packages/yum/yumRepo.py
找到remote = url + '/' + relative
修改为remote = url + '/yum' + relative
4.安装createrepo包
#rpm -qa|grep createrepo
如果没有安装,直接到/yum中找到createrepo-0.4.11-3.el5.noarch.rpm并安装
5.创建资源库:createrepo 本地源目录
#createrepo /yum
6.清空更新信息
#yum clean all
注:
以上仅作为参考,convirt实际所依赖的包有如下
- openssh-server openssh-clients python-devel xen socat dnsmasq tunctl python-paramiko gcc mysql-devel mysql-server
如果能够找出这些包的依赖,就不需要把所有的Server下rpm拷贝到/yum下
二、安装python2.6.5
将Python-2.6.5.tar.bz2拷贝到/usr/local下,解压。
./configure; make ;make install
注:
该处最好是使用python2.6.5,因为我后边压缩的包是基于该python版本安装的tg2。至于其它版本的python使用我压缩的包是否可行,未验证,但是tg2只能用python2.5或2.6哦。
三、将convirt-2.0.1-zh-lt.tar.gz和convirt-install-2.0.1.tar.gz拷贝到工作目录下并解压
注:
请用root进行安装。因为convirt-2.0.1-zh.tar.bz2是本人用root安装成功后打包的,如果用其它用户安装的话,在执行./setup_tg2时会报md5校验失败的错误。如果你想用其它用户在生产环境下进行离线安装的话,请先用此用户在线安装好,打包后使用。
四、将ez_setup.py和setuptools-0.6c11-py2.6.egg和virtualenv-1.7.1.2-py2.6.egg拷贝到$HOME工作目录下,我们使用的是root用户,所以就拷贝到/root下啦
五、修改~/convirt-install/install/cms/common/functions
install_ez_setup()
{
$SUDO wget http://peak.telecommunity.com/dist/ez_setup.py
$SUDO python ez_setup.py
}
改为
install_ez_setup()
{
# $SUDO wget http://peak.telecommunity.com/dist/ez_setup.py
cp -r ~/virtualenv-1.7.1.2-py2.6.egg /usr/local/lib/python2.6/site-packages
$SUDO python ~/ez_setup.py
}
六、执行安装依赖
# ./convirt-install/install/cms/scripts/install_dependencies
七、修改MySQL配置,在/etc/my.cnf文件的[mysqld]部分添加如下内容:
innodb_buffer_pool_size=1G
innodb_additional_mem_pool_size=20M
八、重新启动MySQL:
#/etc/init.d/mysqld restart(rhel)
九、安装convirt
#source ~/convirt-install/install/cms/scripts/install_config
cd ./convirt-install/install/cms/scripts/
./setup_tg2
./setup_convirt
注:
执行./setup_convirt时如果报如下错误:
Cannot run setup while ConVirt is running...
Please use 'convirt-ctl stop' to stop the existing ConVirt process
请删除~/convirt/paster.pid然后再次执行./setup_convirt
以上就是convirt管理端的离线安装啦。至于计算节点的离线安装请参考http://www.cnblogs.com/osyun/archive/2012/04/17/2453580.html
下面我将离线安装过程中整理的脚本发出来,有兴趣的可以研究下,也好明我改造离线安装的原理。
prg_name=~/convirt-install/install/cms/scripts/install_dependencies base=~/convirt-install/install/cms/scripts common_scripts=~/convirt-install/common/scripts common_install_scripts=~/convirt-install/install/cms/common DIST=RedHat CODE_NAME=Tikanga VER=5.5 KERNEL=2.6.18-194.el5xen ARCH=x86_64 source ~/convirt-install/common/scripts/functions source ~/convirt-install/install/cms/common/functions detect_distro # 该函数的作用就是设置DIST、CODE_NAME和VER的值 source ~/convirt-install/common/scripts/RedHat_functions source ~/convirt-install/install/cms/common/RedHat_functions source ~/convirt-install/install/cms/scripts/install_config install_cms_prereq_packages() { $SUDO yum install -y openssh-server openssh-clients python-devel xen socat dnsmasq tunctl python-paramiko gcc mysql-devel mysql-server } install_ez_setup() { $SUDO wget http://peak.telecommunity.com/dist/ez_setup.py #将改行删除 $SUDO python ez_setup.py } install_virtualenv() { $SUDO easy_install virtualenv } #安装~/convirt-install/install/cms/scripts下的HTML-Tagset-3.20.tar.gz和HTML-Parser-3.64.tar.gz install_perl_modules() { T_DIR=`mktemp -d` tar -xzf $base/HTML-Tagset-3.20.tar.gz -C $T_DIR (cd $T_DIR/HTML-Tagset-3.20; perl Makefile.PL ; make; $SUDO make install) if [ "$?" != 0 ]; then ERR_CODE=$? echo "Error installing HTML-Tagset perl module." rm -rf $T_DIR return $ERR_CODE fi tar -xzf $base/HTML-Parser-3.64.tar.gz -C $T_DIR (cd $T_DIR/HTML-Parser-3.64; perl Makefile.PL ; make; $SUDO make install) if [ "$?" != 0 ]; then ERR_CODE=$? echo "Error installing HTML-Parser perl module." rm -rf $T_DIR return $ERR_CODE fi rm -rf $T_DIR } additional_setup_mysql() { /etc/init.d/mysqld start chkconfig --level 345 mysqld on ### Automating this is not working because of stty error. ## TBD: try it with pexpect sometime. ### if [ -e /usr/bin/mysql_secure_installation ]; then ### ## Create response file for running secure installation script ### # Change password ? Y ### # Enter new password : convirt. ### # Remove anonymous user : Y ### # Disallow root login remotely : Y ### # Remove test database ? Y ### # Reload privilege tables now ? Y ### ### MYSQL_SECURE_INST_RESP_FILE=`mktemp -t mysql_secure_inst.resp.XXXXXXXXXX` ### cat <<EOF > $MYSQL_SECURE_INST_RESP_FILE ###Y ###convirt ###Y ###Y ###Y ###Y ###EOF ### ### # run the command with the response file. ### /usr/bin/mysql_secure_installation < $MYSQL_SECURE_INST_RESP_FILE ### rm -f $MYSQL_SECURE_INST_RESP_FILE ### fi if [ -e /usr/bin/mysql_secure_installation ]; then echo "Running mysql_secure_installation." echo "Current root password for fresh installation is blank. So simple press enter." /usr/bin/mysql_secure_installation fi return 0 } status_mysql() { $SUDO /etc/init.d/mysql status }
以上脚本是安装依赖的时候执行的,我就不明确讲解作用了,懂shell的可以研究下。
对于以上有不明确的或者安装过程中遇到问题的欢迎留言,有不足之处,希望各位能够指出,谢谢!