1、安装需要的软件及软件包
#更新apt软件列表 apt-get update #安装mysql apt-get install mysql-server #安装apache2 apt-get install apache2 #安装mod_wsgi apt-get install libapache2-mod-wsgi #安装memcached apt-get install memcached #安装patch apt-get install patch #安排subversion apt-get install subversion
2、配置MySQL
#修改配置文件 vi /etc/mysql/my.cnf #添加下面内容 [client] default-character-set=utf8 [mysqld] character-set-server=utf8 #重启mysql /etc/init.d/mysql restart #新建数据库、用户并授权 mysql -u root -p mysql> CREATE DATABASE reviewboard CHARACTER SET utf8; mysql> CREATE USER 'reviewboard'@'localhost' IDENTIFIED BY 'reviewboard'; mysql> GRANT ALL PRIVILEGES ON reviewboard.* to 'reviewboard'@'localhost';
3、配置svn(我的svn和reviewboard不是在一台机器上的,不需要重新配置)
4、配置Python2.7环境
#安装python-setuptools apt-get install python-setuptools #安装python-dev apt-get install python-dev #安装python-mysqldb apt-get install python-mysqldb #替代方案 #easy_install mysql-python #安装python-svn apt-get install python-svn #安装 libffi-dev apt-get install libffi-dev #安装ReviewBoard easy_install ReviewBoard #你可以用pip安装 #eays_install pip #pip install pipdeptree #pip install ReviewBoard
5、安装网站
#这句话会报错,因为依赖的Django版本冲突所导致的 rb-site install /var/www/reviewboard #查看插件依赖 pipdeptree #可以看到 #ReviewBoard依赖Django [required: <1.7,>=1.6.11, installed: 1.8] #django-haystack依赖Django [required: >=1.8, installed: 1.8] argparse==1.2.1 chardet==2.3.0 lxml==3.4.0 MySQL-python==1.2.3 numpy==1.8.2 pycups==1.9.63 pycurl==7.19.5 pygobject==3.14.0 pysmbc==1.0.15.3 python-apt==0.9.3.11 python-debian==0.1.27 - six [required: None, installed: 1.8.0] python-debianbts==1.11 pyxdg==0.25 reportbug==6.6.3 ReviewBoard==2.5.1 - Django [required: <1.7,>=1.6.11, installed: 1.8] - django-evolution [required: <=0.7.999,>=0.7.5, installed: 0.7.6] - Django [required: <1.7.0,>=1.4.10, installed: 1.8] - django-haystack [required: >=2.3.1, installed: 2.5.0] - Django [required: >=1.8, installed: 1.8] - Django [required: <1.10, installed: 1.8] - django-multiselectfield [required: None, installed: 0.1.4] - django [required: >=1.4, installed: 1.8] - Djblets [required: <=0.9.999,>=0.9, installed: 0.9.3] - Django [required: >=1.6.11,<1.8.999, installed: 1.8] - django-pipeline [required: <1.3.9999,>=1.3.23, installed: 1.3.27] - futures [required: >=2.1.3, installed: 3.0.5] - feedparser [required: >=5.1.2, installed: 5.2.1] - pillowfight [required: None, installed: 0.2] - Pillow [required: None, installed: 2.6.1] - pytz [required: None, installed: 2016.7] - docutils [required: None, installed: 0.12] - markdown [required: <2.4.999,>=2.4.0, installed: 2.4.1] - mimeparse [required: >=0.1.3, installed: 0.1.3] - paramiko [required: >=1.12, installed: 2.0.2] - cryptography [required: >=1.1, installed: 1.5.2] - cffi [required: >=1.4.1, installed: 1.8.3] - pycparser [required: None, installed: 2.14] - enum34 [required: None, installed: 1.1.6] - idna [required: >=2.0, installed: 2.1] - ipaddress [required: None, installed: 1.0.17] - pyasn1 [required: >=0.1.8, installed: 0.1.9] - setuptools [required: >=11.3, installed: 28.6.0] - six [required: >=1.4.1, installed: 1.8.0] - pyasn1 [required: >=0.1.7, installed: 0.1.9] - pycrypto [required: >=2.6, installed: 2.6.1] - Pygments [required: >=1.6, installed: 2.0.1] - python-dateutil [required: ==1.5, installed: 1.5] - python-memcached [required: None, installed: 1.58] - six [required: >=1.4.0, installed: 1.8.0] - pytz [required: None, installed: 2016.7] - recaptcha-client [required: None, installed: 1.0.6] - Whoosh [required: >=2.6, installed: 2.7.4] roman==2.0.0 SOAPpy==0.12.22 - defusedxml [required: None, installed: 0.4.1] - wstools [required: None, installed: 0.4.3] - docutils [required: None, installed: 0.12] wsgiref==0.1.2 #所以降级django-haystack就好了 easy_install -m django easy_install -m django-haystack easy_install django-haystack==2.3.1 easy_install reviewboard
6、安装网站,并修改网站权限
#安装网站,按提示输入 rb-site install /var/www/reviewboard chown -R www-data /var/www/reviewboard/htdocs/media/uploaded chown -R www-data /var/www/reviewboard/data chown -R www-data /var/www/reviewboard/logs chown -R www-data /var/www/reviewboard/htdocs/media/ext chown -R www-data /var/www/reviewboard/htdocs/static/ext
7、配置访问权限
#配置访问权限 vi /var/www/reviewboard/conf/settings_local.py #修改下面一行,这是不限制任何访问 ALLOW_HOSTS=['*']
8、配置apache2虚拟目录
cp /var/www/reviewboard/conf/apache-wsgi.conf /etc/apache2/sites-available/reviewboard.conf #按实际需要的部署情况,编辑reviewboard.conf cd /etc/apache2/sites-enabled ln -s ../sites-avaiable/reviewboard.conf
9、重启apache2
/etc/init.d/apache2 restart
10、打开浏览器就可以登录啦
11、另外,我是在虚拟机中部署的reviewboard,我尝试了用nginx反向代理reviewboard,但没有成功。
用firebug看到,json中的ip地址没有改写,最后发现是因为django没有正确的处理absolute_path。
好像增加一些django的配置就好了,但实在是没时间处理了。
最后用bridege方式将虚拟机映射出来,完成部署。