Phabricator Centos7 安装部署

jonathan
2018-10-16 / 0 评论

1. mkdir & download

mkdir -p /data/app/pha
cd /data/app/pha
wget http://www.phabricator.com/rsrc/install/install_rhel-derivs.sh
chmod +x install_rhel-derivs.sh
./install_rhel-derivs.sh

2. add nginx config

vi /etc/nginx/conf.d/pha.conf
server {
    server_name p.com;
    root    /data/app/pha/phabricator/webroot;
    location / {
        index index.php;
        rewrite ^/(.*)$ /index.php?__path__=/$1 last;
    }
    location = /favicon.ico {
        try_files $uri =204;
    }
    location /index.php {
        fastcgi_pass  localhost:9000;
        fastcgi_index  index.php;
        #required if PHP was built with --enable-force-cgi-redirect
        fastcgi_param REDIRECT_STATUS  200;
        #variables to make the $_SERVER populate in PHP
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param QUERY_STRING    $query_string;
        fastcgi_param REQUEST_METHOD   $request_method;
        fastcgi_param CONTENT_TYPE    $content_type;
        fastcgi_param CONTENT_LENGTH   $content_length;
        fastcgi_param SCRIPT_NAME    $fastcgi_script_name;
        fastcgi_param GATEWAY_INTERFACE CGI/1.1;
        fastcgi_param SERVER_SOFTWARE  nginx/$nginx_version;
        fastcgi_param REMOTE_ADDR    $remote_addr;
    }
}

2. add apache config

vi /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
    # Change this to the domain which points to your host.
    ServerName team.idinu.com
    # Change this to the path where you put 'phabricator' when you checked it
    # out from GitHub when following the Installation Guide.
    #
    # Make sure you include "/webroot" at the end!
    DocumentRoot /opt/phabricator/webroot
    RewriteEngine on
    RewriteRule ^/rsrc/(.*)   -            [L,QSA]
    RewriteRule ^/favicon.ico  -            [L,QSA]
    RewriteRule ^(.*)$     /index.php?__path__=$1 [B,L,QSA]
</VirtualHost>
<Directory "/opt/phabricator/webroot">
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

Apache 2.4 and Newer

<Directory "/path/to/phabricator/webroot">
    Require all granted
</Directory>

3. 初始化

phabricator/ $ ./bin/storage upgrade

4. 本机添加默认对应domain

vi /etc/hosts
127.0.0.1   ph.xx.com

5. 更新

Updating PhabricatorSince Phabricator is under active development, you should update frequently. To update Phabricator:

  • Stop the webserver (including php-fpm, if you use it).
  • Run git pull in libphutil/, arcanist/ and phabricator/.
  • Run phabricator/bin/storage upgrade.
  • Restart the webserver (and php-fpm, if you stopped it earlier).

For more details, see Configuration Guide. You can use a script similar to this one to automate the process: http://www.phabricator.com/rsrc/install/update_phabricator.sh

5. 常见配置问题修复

1. Base URI Not Configured

设置对应的url

phabricator/ $ ./bin/config set phabricator.base-uri 'http://p.com/'

2. Phabricator Daemons Are Not Running

通过phd用户启用phd

phabricator/ $ ./bin/phd start

详细过程:

vi /etc/passwd
phd:x:501:501:Phd:/var/tmp/phd:/bin/bash
git:x:500:500:Git:/data/app/repo:/bin/bash
vi /etc/shadow
phd:!!:16135::::::
git:NP:16135:0:99999:7:::
visudo
## HTTP:
apache ALL=(phd) SETENV: NOPASSWD: /usr/libexec/git-core/git-http-backend
## SSH:
git ALL=(phd) SETENV: NOPASSWD: /usr/bin/git-upload-pack, /usr/bin/git-receive-pack, /bin/sh
vi /etc/group
git:x:500:git
phd:x:501:phd
./bin/config set phd.user phd
./bin/config set diffusion.ssh-user git
cp /data/app/pha/phabricator/resources/sshd/phabricator-ssh-hook.sh /usr/libexec/phabricator-ssh-hook.sh
chown root /usr/libexec/phabricator-ssh-hook.sh
chmod 755 /usr/libexec/phabricator-ssh-hook.sh
vi /usr/libexec/phabricator-ssh-hook.sh

Change VCSUSER="vcs-user" to VCSUSER="git" Change ROOT="/path/to/phabricator" to ROOT="/data/app/pha/phabricator"

cp /data/app/pha/phabricator/resources/sshd/sshd_config.phabricator.example /etc/ssh/sshd_config.phabricator
vi /etc/ssh/sshd_config.phabricator

Change AuthorizedKeysCommand /etc/phabricator-ssh-hook.sh to AuthorizedKeysCommand /usr/libexec/phabricator-ssh-hook.sh Change AuthorizedKeysCommandUser vcs-user to AuthorizedKeysCommandUser git

ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
sudo /usr/sbin/sshd -f /etc/ssh/sshd_config.phabricator

需要添加一个服务器的rsa key

ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub

Go to xx.com Settings->SSH Public Keys -> Upload .. 验证是否成功

echo {} | ssh git@p.com conduit conduit.ping

修改默认ssh端口22到222

vi /etc/ssh/sshd_config

Change port 22 to port 222

systemctl restart sshd
firewall-cmd --zone=public --add-port=222/tcp --permanent
firewall-cmd --reload

用phd用户启动phd

mkdir -p /var/tmp/phd
chown phd:phd -R /var/tmp/phd
./bin/phd start

评论

博主关闭了当前页面的评论