linux centos7 安装Phabircator

Phabricator 是facebook开发的一套代码审核工具,基于PHP和Mysql开发。

准备工作:

系统:Linux CentOS7
环境:

  1. Apache(或nginx,或lighttpd):需要Apache 2.2.7以上版本。
  2. MySQL:MySQL必需
  3. PHP:需要PHP5.2以上版本
  4. Phabricator:phabricator安装包

安装

  • 修改ip地址(可忽略)

vi /etc/sysconfig/network-scripts/ifcfg-ethx

注:
1.进入network-scripts后自己看一下ifcfg-ethx的名称再进行修改
2.如果是虚拟机的linux最好把网络连接方式设为桥接模式

BOOTPROTO=static #选项为static,dhcp或bootp,分别对应静态指定的 ip地址,通过dhcp协议获得的ip地址,通过bootp协议获得的ip地址
IPADDR=192.168.116.5 #这个为静态IP地址
GATEWAY=192.168.116.1 #默认网关
NETMASK=255.255.255.0 #子网掩码
DNS1=218.85.157.99 #DNS配置
  • 安装Apache

关闭firewall:(关闭防火墙)

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

运行命令:yun install httpd
现在打开http://192.168.116.4地址,看看有没有Apache的默认页面出来了?如果有就对了。

  • 安装mysql

下载mysql的repo源

$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
安装mysql-community-release-el7-5.noarch.rpm包

$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。

  1. 安装mysql

$ sudo yum install mysql-server
根据步骤安装就可以了,不过安装完成后,没有密码,需要重置密码。

  1. 重置密码重>置密码前,首先要登录

$ mysql -u root
登录时有可能报这样的错:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2),原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户:

'$ sudo chown -R openscanner:openscanner /var/lib/mysql'
然后,重启服务:

$ service mysqld restart
接下来登录重置密码:

$ mysql -u root
mysql > use mysql;mysql > update user set password=password(‘123456‘) where user=‘root‘;mysql > exit;

错误信息
  1. 错误信息:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
    解决方法:打开/etc/my.cnf,看看里面配置的socket位置是什么目录。“socket=/var/lib/mysql/mysql.sock”
    路径和“/tmp/mysql.sock”不一致。建立一个软连接:ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
  • 安装PHP

yum install php php-devel
重启apache使php生效
/etc/init.d/httpd restart
此时可以在目录:/var/www/html/下建立一个index.hph文件
代码:
<?php phpinfo(); ?>
然后访问这个文件,就能看到PHP的一些信息,index.php

安装php的扩展(可不装)
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

  • 安装Phabricator

#######把centos版的phabricator安装脚本下载到opt目录并安装
cd /opt
下载 https://secure.phabricator.com/source/phabricator/browse/master/scripts/install/ 页面的三个文件
install_rhel-derivs.sh:wget https://p.phcdn.net/file/data/@secure/q5leodur5raca77mplfy/PHID-FILE-3xzyr2upmwbslnms7lgb/install_rhel-derivs.sh

install_ubuntu.sh:wget https://p.phcdn.net/file/data/@secure/hoqul6hmowgimbo5oklh/PHID-FILE-jiplxc5x72gmpd3pqw2t/install_ubuntu.sh

update_phabricator.sh:wget https://p.phcdn.net/file/data/@secure/ajyfdzpe3ymmnm3imogd/PHID-FILE-kujsi3om7abpuc6frgzd/update_phabricator.sh

chmod 777 install_rhel-derivs.sh
./install_rhel-derivs.sh

#######安装必要插件

yum -y install pcre-devel
yum -y install php-pear
yum -y install pecl(发现不装这个也没事)
yum -y install apc(发现不装这个也没事)

#######把这些文件移动到apache的DocumentRoot下

mv /opt/arcanist /var/www/html
mv /opt/libphutil /var/www/html
mv /opt/phabricator /var/www/html

#######关门防火墙和selinux
/etc/init.d/iptables stop
setenforce 0
chkconfig iptables off
im /etc/selinux/config

This file controls the state of SELinux on the system.
SELINUX= can take one of these three values:
enforcing - SELinux security policy is enforced.
permissive - SELinux prints warnings instead of enforcing.
disabled - No SELinux policy is loaded.
SELINUX=disabled
SELINUXTYPE= can take one of these two values:
targeted - Targeted processes are protected,
mls - Multi Level Security protection.
SELINUXTYPE=targeted

#######修改vim /etc/httpd/conf/httpd.conf以下几点
#######设置DocumentRoot

DocumentRoot "/var/www/html/phabricator/webroot"

#######加入index.php

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

#######启动必要的服务
service httpd restart
chkconfig httpd on
service mysqld restart
chkconfig httpd on

#######更新phabricator
cd /var/www/html/phabricator
./bin/storage upgrade

#######在浏览器中输入网址 192.168.*.* 即可。


  • 配置Phabricator

注:在配置svn的url获取时,svn的地址必须是原生的.这样才可以生成ssl证书
如:https://svn.qq.net:9443/svn/ProductCenter
此处必须是根目录

  • 开启LDAP权限

需要扩展LDAP PHP,使用命令
apt-get install php5-ldap

yum install php-ldap
然后安装完成后,要重启httpd就可以用了
service httpd restart


附件:源调整 接入阿里的源

  1. 备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

  1. 下载新的CentOS-Base.repo 到cd /etc/yum.repos.d/

CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  1. 之后运行yum makecache生成缓存

联系方式:505242941@qq.com

原文地址:https://www.cnblogs.com/wangSOA/p/6598758.html