正式环境安装样例
mysql和apache在安装操作系统前已经安装完成,下面描述安装过程。
注意:
- 如果mysql未安装,则使用命令sudo apt-get install mysql-server安装mysql,中间会让你输入root的密码。
sudo chmod 0644 /etc/mysql/my.cnf
sudo service mysql restart
为解决中文乱码问题,需要对编码进行修改,打开/etc/mysql/my.cnf文件,在[client]后添加:
default-character-set=utf8
找到[mysqld]节,修改或增加以下行: default-storage-engine=INNODB character-set-server=utf8 collation-server=utf8_general_ci
找到[mysql]节,改或增加以下行: default_character_set=utf8
完成后,重新启动服务器,或重启mysql:
sudo /etc/init.d/mysql restart
sudo service mysql restart
注意:
如果修改my.cnf,并更改改文件的权限为777,可能会报错,如:
Warning: World-writable config file '/etc/mysql/my.cnf' is ignored
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)
The first line is a permissions error. MySQL is complaining its config file is too open,解决方法:
sudo chmod 0644 /etc/mysql/my.cnf
sudo service mysql restart
sudo chown mysql:mysql /var/run/mysqld (Maybe)
输入mysql打开,使用如下命令检查数据库编码:
mysql> SHOW VARIABLES LIKE'characterset%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
当显示为utf8,即表示编码更改成功。
创建数据库:
mysql> create database reviewboard default charset utf8 collate utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
mysql> create user 'reviewboard'@'localhost' identified by 'reviewboard';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on reviewboard.* to 'reviewboard'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye
有关调整已有数据库的编码更新问题,可参考:
http://tonybai.com/2009/10/05/chinese-support-for-review-board/
安装mod-wsgi
sudo apt-get install libapache2-mod-wsgi
安装python-ldap(配置域集成必须的模块)
sudo apt-get install python-ldap
根据文档依次安装
sudo apt-get install python-setuptools
sudo apt-get install python-dev
sudo apt-get install memcached
sudo easy_install python-memcached
sudo apt-get install patch
sudo easy_install ReviewBoard
安装mysql-python之前,需要先安装,libmysqld-dev:
sudo apt-get install libmysqld-dev
sudo easy_install -U distribute (No Need Now),否则报错:
You seem to have installed distribute and setuptools, your easy_install script tries to load the entry point from distribute, but setuptools is found first.
You should remove distribute, as it has been merged back into setuptools and is now obsolete. Probably you'll need to reinstall setuptools after that to get everyting working again.
sudo easy_install mysql-python
sudo apt-get install python-mysqldb
否则会报错:
EnvironmentError: mysql_config not found。
继续根据文档安装
sudo apt-get install subversion python-svn
sudo apt-get install python-svn-dbg python-gdbm-dbg python-tk-dbg (Optional)
sudo easy_install django-storages
sudo apt-get install pylucene
sudo easy_install nose Sphinx
安装配置参数:
sudo rb-site install /var/www/reviewboard
Domain Name: localhost
Root Path [/]:
Shipped Media URL[static/]: (1.7版本引入)
Media URL [media/]:
Database Type: 1 mysql
Database Name [reviewboard]:
Database Server [localhost]:
Database Username: reviewboard
Database Password: reviewboard
Cache Type: 1 memcached (recommended)
Memcache Server [memcached://localhost:11211/]:
Web Server: 1 apache
Python Loader: 1 wsgi (recommended)
Username [admin]:
Password: spreadtrum
E-Mail Address: [email protected]
根据文档后续配置过程
sudo chown -R www-data /var/www/reviewboard/htdocs/media/uploaded
sudo chown -R www-data /var/www/reviewboard/htdocs/media/ext (1.7版本引入)
sudo chown -R www-data /var/www/reviewboard/data
cd /etc/apache2/sites-available
$ ls
default default-ssl
$ pwd
/etc/apache2/sites-available
$ sudo cp /var/www/reviewboard/conf/apache-wsgi.conf reviewboard.conf
$ ls
default default-ssl reviewboard.conf
$ cd ../sites-enabled
$ pwd
/etc/apache2/sites-enabled
$ sudo ln -s ../sites-available/reviewboard.conf .
$ sudo rm -rf 000-default
$ sudo /etc/init.d/apache2 restart
- Restarting web server apache2
... waiting ...done.
$ ls
配置LDAP、Email设置。
登录网址: