基于centos搭建reviewboard
基于centos ,apache, mysql 安裝 reviewboard 3.0.17
Prepartion
1.CentOS Linux release 8.1.1911 (Core)
2.Samba install
3.dependences install
$ yum install gcc libffi-devel openssl-devel patch $ sudo yum install python2-devel.x86_64 $ sudo dnf install redhat-rpm-config $ sudo yum install makeApache
1.Install Apache
To install Apache on your CentOS server, use the following command:
$ sudo yum install httpd.x86_642.Activate Apache
To activate Apache, start its service first.
1.start httpd.service
$sudo systemctl start httpd.service3.Verify Apache Service
Display information about Apache, and verify it’s currently running with:
$ sudo systemctl status httpd.service ● httpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)Active: active (running) since Mon 2020-01-27 08:55:21 EST; 1s agoDocs: man:httpd.service(8)Main PID: 3536 (httpd)Status: "Started, listening on: port 80"Tasks: 213 (limit: 5030)Memory: 17.2MCGroup: /system.slice/httpd.service├─3536 /usr/sbin/httpd -DFOREGROUND├─3537 /usr/sbin/httpd -DFOREGROUND├─3538 /usr/sbin/httpd -DFOREGROUND├─3539 /usr/sbin/httpd -DFOREGROUND└─3540 /usr/sbin/httpd -DFOREGROUNDJan 27 08:55:21 soar systemd[1]: Starting The Apache HTTP Server... Jan 27 08:55:21 soar systemd[1]: Started The Apache HTTP Server. Jan 27 08:55:21 soar httpd[3536]: Server configured, listening on: port 804.Configure firewalld to Allow Apache Traffic
In a standard installation, CentOS 7 is set to prevent traffic to Apache.
Normal web traffic uses the http protocol on Port 80, while encrypted web traffic uses the https protocol, on Port 443.
5.Install mod_wsgi
需要先確認(rèn)是否有安裝apxs,若未安裝通過httpd-devl 安裝
$ whereis apxs $ sudo yum install httpd-devel.x86_64安裝mod_wsgi
$wget https://pypi.python.org/packages/28/a7/de0dd1f4fae5b2ace921042071ae8563ce47dac475b332e288bc1d773e8d/mod_wsgi-4.5.7.tar.gz $tar xzf mod_wsgi-4.5.7.tar.gz $cd mod_wsgi-4.5.7/ $./configure --with-apxs=/usr/bin/apxs --with-python=/usr/bin/python2 $sudo make && make install $cd ../配置http.conf
$ sudo vim /etc/httpd/conf/httpd.conf添加一行: LoadModule wsgi_module modules/mod_wsgi.soMySQL
1.Install MySQL
$ wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.19-1.el8.x86_64.rpm-bundle.tar$ tar xvf mysql-8.0.19-1.el8.x86_64.rpm-bundle.tar $ sudo rpm -ivh mysql-community-common-8.0.19-1.el8.x86_64.rpm $ sudo rpm -ivh mysql-community-libs-8.0.19-1.el8.x86_64.rpm $ sudo rpm -ivh mysql-community-client-8.0.19-1.el8.x86_64.rpm $ sudo rpm -ivh mysql-community-devel-8.0.19-1.el8.x86_64.rpm $ sudo rpm -ivh mysql-community-server-8.0.19-1.el8.x86_64.rpm2.Install MySQLClient
Must installed dependences before install mysqlclient,you can reference “Prepartion” section
$ sudo pip2 install -U mysqlclient3.Config MySQL
1.Reference apache to start mysql service
$ sudo systemctl start mysqld.service $ sudo systemctl enable mysqld.service $ sudo systemctl status mysqld.service ● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Mon 2020-01-27 10:36:00 EST; 28s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlMain PID: 14388 (mysqld)Status: "Server is operational"Tasks: 39 (limit: 5030)Memory: 243.1MCGroup: /system.slice/mysqld.service└─14388 /usr/sbin/mysqldJan 27 10:35:36 soarnex systemd[1]: Starting MySQL Server... Jan 27 10:36:00 soarnex systemd[1]: Started MySQL Server.2.Modify mysql password
第一步:修改配置文件免密碼登錄mysql
1、進(jìn)入文件:vi /etc/my.cnf,添加skip-grant-tables2、重啟mysql: $ sudo systemctl restart mysqld.service第二步免密碼登錄mysql
1、登錄:mysql -u root -p2、提示輸入密碼按回車進(jìn)入3、進(jìn)入數(shù)據(jù)庫,輸入:use mysql;4、查看root用戶信息:select host, user, authentication_string, plugin from user;5、更新root用戶信息,把密碼設(shè)置為空字符串:update user set authentication_string='' where user='root';第三步、退出mysql;注釋掉/etc/my.cnf文件最后的 skip-grant-tables ;重啟mysql
$ sudo systemctl restart mysqld.service第四步:設(shè)置密碼
1、重新開啟一個(gè)客戶端;2、登錄mysql(這時(shí)候還是不用輸入密碼,因?yàn)樯厦嬉呀?jīng)把密碼設(shè)置為空字符串了);3、修改root用戶密碼:ALTER user 'root'@'localhost' IDENTIFIED BY 'root'; 提示如下信息表示修改成功: Query OK, 0 rows affected (0.04 sec)4、退出mysql后就可以用密碼登錄了第四步的第3點(diǎn)執(zhí)行容易出現(xiàn)如下信息提示,無法修改密碼,請從第一步重復(fù)再次執(zhí)行,(第三步與第四步的執(zhí)行可以多等一些時(shí)間–猜測與時(shí)間有關(guān))
You must reset your password using ALTER USER statement before executing this statement第五步:修改密碼策略
設(shè)置密碼的默認(rèn)規(guī)則:大于8位的包含數(shù)字、字符、特殊字符、大小寫,此規(guī)則可以修改,
如下是MySQL 8.0版本修改密碼策略的方法:root密碼:root123
mysql> SHOW VARIABLES LIKE 'validate_password%'; +--------------------------------------+--------+ | Variable_name | Value | +--------------------------------------+--------+ | validate_password.check_user_name | ON | | validate_password.dictionary_file | | | validate_password.length | 8 | | validate_password.mixed_case_count | 1 | | validate_password.number_count | 1 | | validate_password.policy | MEDIUM | | validate_password.special_char_count | 1 | +--------------------------------------+--------+ 7 rows in set (0.02 sec)mysql> set global validate_password.policy=0; Query OK, 0 rows affected (0.00 sec)mysql> set global validate_password.length=1; Query OK, 0 rows affected (0.00 sec)mysql> SHOW VARIABLES LIKE 'validate_password%'; +--------------------------------------+-------+ | Variable_name | Value | +--------------------------------------+-------+ | validate_password.check_user_name | ON | | validate_password.dictionary_file | | | validate_password.length | 4 | | validate_password.mixed_case_count | 1 | | validate_password.number_count | 1 | | validate_password.policy | LOW | | validate_password.special_char_count | 1 | +--------------------------------------+-------+ 7 rows in set (0.00 sec)mysql> ALTER user 'root'@'localhost' IDENTIFIED BY 'root123'; Query OK, 0 rows affected (0.02 sec)3.使用mysql 管理工具 navicat
https://blog.csdn.net/dabao87/article/details/80571877
4.數(shù)據(jù)庫的備份與恢復(fù)
https://www.cnblogs.com/boundless-sky/p/6087976.html
5.Reviewboard mysql 異常恢復(fù)
reviewboard可以了, 你試下: 以前的指令是:https://stackoverflow.com/questions/8843776/mysql-table-is-marked-as-crashed-and-last-automatic-repair-failed MySQL table is marked as crashed and last (automatic?) repair failedsudo service mysql stop cd /var/lib/mysql/$DATABASE_NAME myisamchk -r $TABLE_NAME myisamchk -r -v -f $TABLE_NAME sudo service mysql startReviewboard
1.Install Reviewboard
sudo pip2 install oauthlib==1.0.1 sudo pip2 install Reviewboard2.Creating Review Board Site
Must Create reviewboard database and user first.
1.MySQL
In MySQL, before creating your database, make sure that your server is configured to use the UTF-8 encoding for text. In the file my.cnf, add the following settings:
[client] default-character-set=utf8[mysqld] character-set-server=utf8After making these changes, restart your MySQL server.
Next, start up the mysql command prompt as your root user, and create a new database and user (replacing myuser and myspassword with your desired username and password, respectively):
$ mysql -u root -p mysql> CREATE DATABASE reviewboard CHARACTER SET utf8; mysql> CREATE USER 'toney'@'localhost' IDENTIFIED BY 'toney123'; mysql> GRANT ALL PRIVILEGES ON reviewboard.* to 'toney'@'localhost';Note:
此處reviewboard database 用戶可以創(chuàng)建為 reviewboard/reviewboard,便于記憶
2.Install site
$ sudo rb-site install /var/www/review.com需特別注意如下項(xiàng):
- What is the login and password for this database?
- Create an administrator account
3.Configuration
創(chuàng)建軟連接
$ cd /etc/httpd/conf.d $ sudo ln -s /var/www/review.com/conf/apache-wsgi.conf review.conf修改confsettings_local.py
修改 DEBUG=True -- enable debug DISABLE_FOLLOW_MENU = True -- disabled follow menu sudo vim /var/www/review.com/confsettings_local.py去除Suuport
vim ./lib64/python2.7/site-packages/reviewboard/templates/base/_nav_support_menu.html<li> <a href="#"> {% trans "Support" %} <span class="rb-icon rb-icon-dropdown-arrow"></span> </a> <ul> <li><a href="{{RB_MANUAL_URL}}">{% trans "Documentation" %}</a></li> <li><a href="{% url 'support' %}">{% trans "Get Support" %}</a></li> </ul> </li>修改目錄權(quán)限
$ sudo chown -R apache "/var/www/review.com/data" $ sudo chown -R apache "/var/www/review.com/htdocs/media/ext"安裝Apache的時(shí)候默認(rèn)創(chuàng)建apache 用戶,訪問頁面時(shí)都是通過此用戶訪問相關(guān)文件,所以需要修改相關(guān)文件的權(quán)限
Note:可以通過/etc/httpd/conf/httpd.conf 修改訪問用戶名
4.Restart httpd.service
$ sudo systemctl restart httpd.service此時(shí)可以正常訪問reviewboard site.
總結(jié)
以上是生活随笔為你收集整理的基于centos搭建reviewboard的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Sangfor
- 下一篇: demoのpython学习笔记【1】