Centos 7.6 Install Phabricator

Centos 7.6 系統下載

http://mirrors.cqu.edu.cn/CentOS/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
mysql 安裝
yum install numactl libaio perl-Time-HiRes per-devel net-tools vim ntp wget -y

查看系統mariadb-libs
rpm -qa | grep mariadb-libs postfix

卸載系統的mariadb-libs
rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
rpm -e --nodeps postfix-2.10.1-7.el7.x86_64

wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.25-1.el7.x86_64.rpm-bundle.tar

rpm 安裝mysql
rpm -ivh mysql-community-common-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm

配置優化及功能開啓
vi /etc/my.cnf
lower_case_table_names=1   #不區分大小寫
character_set_server=utf8  #語言
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES #SQL錯誤語法禁止插入數據庫
max_connections=1000  #最大連接數
log_bin_trust_function_creators = on #開啓二進制日誌
#表壓縮
innodb_file_per_table=1
innodb_file_format=Barracuda

啓動mysql
systemctl start mysqld
systemctl enable mysqld

mysql生成隨機密碼
grep 'temporary password' /var/log/mysqld.log

mysql重新登陸(使用隨機生成的密碼登錄)
mysql -uroot -p  

配置Mysql 密碼以及權限
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Report@123';

允許root用戶在任何地方進行遠程登錄,並具有所有庫任何操作權限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Report@123' WITH GRANT OPTION;
FLUSH PRIVILEGES;

開啓端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent

重啓防火牆
firewall-cmd --reload
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
依賴安裝
yum install -y git  php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash php-mbstring

語法高亮設置
yum install python-pygments -y

git克隆phabricator
mkdir -p /var/www/html/pha/
git clone https://github.com/phacility/libphutil.git
git clone https://github.com/phacility/arcanist.git
git clone https://github.com/phacility/phabricator.git

vi /etc/httpd/conf/httpd.conf
#120
DocumentRoot "/var/www/html/pha/phabricator/webroot"

163 <IfModule dir_module>
164     DirectoryIndex index.html index.php
165 </IfModule>

174 <VirtualHost *:80>
    RewriteEngine on
    RewriteRule ^/rsrc/(.) -   [L,QSA]
    RewriteRule ^/favicon.ico   -   [L,QSA]
    RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]  
</VirtualHost>

#262
<Directory /var/www/html/pha/phabricator/webroot/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
</Directory>

開放端口
firewall-cmd --zone=public --add-port=80/tcp --permanent

重啓防火牆
firewall-cmd --reload

漢化中文,然後頁面設置中文就ok
/var/www/html/pha/phabricator/src/extensions
git clone https://github.com/banxuelai/bxl.git

啓動
systemctl start httpd
systemctl enable httpd

vi /var/www/html/pha/phabricator/conf/local,jes
{
  "mysql.host": "localhost",
  "mysql.pass": "root",
  "mysql.user": "root",
  "mysql.port": "3306"
}

啓動守護進程即可
cd /var/www/html/pha/phabricator/
./bin/phd start

因爲默認使用mysql存儲,需要修改對mysql存儲的限制
cd /var/www/html/pha/phabricator/
./bin/config set storage.mysql-engine.max-size 104857600

爲phabricator創建mysql相關數據表
cd /var/www/html/pha/phabricator/
./bin/storage upgrade --force

創建賬號成爲管理員
cd /var/www/html/pha/phabricator/
./bin/accountadmin
Skip easy setup and create account? [y/N] y
Enter a username: admin
Do you want to create a new 'admin' account? [Y/n] y
Enter user real name: admin
Enter user email address: [email protected]
Is this user a bot? [y/N] n
Should this user be an administrator? [y/N] y
Save these changes? [Y/n] y

授權管理員
cd /var/www/html/pha/phabricator/
 ./bin/auth recover admin
http://ip/login/once/recover/3/5dsfdy7v4vkrilnhnwyp4xgn4e75fk3o/

刪除用戶管理員
cd /var/www/html/pha/phabricator
./bin/remove destroy @admin

刪除代碼庫
cd /var/www/html/pha/phabricator
./bin/remove destroy R3

用於SSH訪問,需要創建,一般用於SSH克隆代碼庫
設置或創建賬戶
cd /var/www/html/pha/phabricator
./bin/config set phd.user root

# vcs-user 創建並設置
useradd git
usermod -p NP git
usermod -s /bin/sh git

Phabricator中配置,顯示ssh clone地址
cd /var/www/html/pha/phabricator
./bin/config set diffusion.ssh-user git    
./bin/phd restart

配置git賬戶運行權限,進入 sudoers文件
vi /etc/sudoers
# 添加如下配置
git ALL=(root) SETENV: NOPASSWD: /usr/libexec/git-core/git-http-backend, /usr/bin/git,/usr/bin/git-upload-pack, /usr/bin/git-receive-pack

添加配置 phabricator-ssh-hook.sh
cd /var/www/html/pha/phabricator
cp ./resources/sshd/phabricator-ssh-hook.sh /usr/libexec/phabricator-ssh-hook.sh
chmod 755 /usr/libexec/phabricator-ssh-hook.sh
# 進入文件
vi /usr/libexec/phabricator-ssh-hook.sh
# 修改如下配置
# ssh帳戶
VCSUSER="git"
# phabricator安裝目錄路徑
ROOT="/var/www/html/pha/phabricator

# 添加配置 sshd_config.phabricator
cd /var/www/html/pha/phabricator
cp ./resources/sshd/sshd_config.phabricator.example /etc/ssh/sshd_config.phabricator
# 進入文件
vi /etc/ssh/sshd_config.phabricator
# 修改如下配置
#
AuthorizedKeysCommand /usr/libexec/phabricator-ssh-hook.sh
# openSSH6.2以下,此字段爲AuthorizedKeysCommandRunAs
AuthorizedKeysCommandUser git
AllowUsers git

# 上述文件默認端口port字段爲2222,則phabricator中配置
cd /var/www/html/pha/phabricator
./bin/config set diffusion.ssh-port 2222

# 開放端口
firewall-cmd --zone=public --add-port=2222/tcp --permanent
# 重啓防火牆
firewall-cmd --reload

啓動phabricator ssh服務,查看是否可以啓動
/usr/sbin/sshd -d -d -d -f /etc/ssh/sshd_config.phabricator

正式啓用:此ssh服務跟系統默認ssh不是一個進程
/usr/sbin/sshd -f /etc/ssh/sshd_config.phabricator  

cd /var/www/html/pha/phabricator
./bin/phd restart

重啓只要執行上面相同的命令即可,若要關閉服務:
ps -ef | grep sshd

配置http,顯示http clone地址phabricator中配置
cd /var/www/html/pha/phabricator
./bin/config set diffusion.allow-http-auth true      
           
添加環境變量,數組可放多個   
cd /var/www/html/pha/phabricator
./bin/config set environment.append-paths '["/usr/libexec/git-core"]'   

重啓守護進程
cd /var/www/html/pha/phabricator
./bin/phd restart

配置apache賬戶運行權限,進入sudoers文件(注意:git-http-backend:git yum安裝時git-http-backend的路徑:/usr/libexec/git-core/git-http-backend)
vi /etc/sudoers
添加如下配置
apache ALL=(root) SETENV: NOPASSWD:  /usr/bin/git, /usr/bin/git-upload-pack, /usr/bin/git-receive-pack, /usr/bin/ssh, /usr/libexec/git-core/git-http-backend

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章