本文是在centOs 7 上安裝sentry的全過程,親測可行
1. 關(guān)掉CentOs防火墻,允許服務(wù)器聯(lián)網(wǎng)
1.1 su 更換root用戶
1.2 sudo chmod 0777 /etc/sudoers
1.3 vi /etc/sudoers
1.4 在root ALL=(ALL) ALL下添加一行
john ALL=(ALL) ALL
1.5 sudo chmod 0440 /etc/sudoers 更換為原來的權(quán)限
1.6 關(guān)閉防火墻
sudo service firewalld stop
2. 編輯網(wǎng)卡驅(qū)動文件
2.1 vi /etc/sysconfig/network-scripts/ifcfg-ens33
將 ONBOOT設(shè)置為yes
2.2 重啟網(wǎng)絡(luò)服務(wù)
sudo service network restart
3. 安裝wget
3.1 yum install wget
4. 安裝ssh
4.1 yum install openssh-server
5. 安裝 gcc
5.1 yum install gcc
6. CentOs換源
6.1 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
6.2 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
6.3 yum clean all
6.4 yum makecache
7. 更新tcl 8.5
7.1 wget http://downloads.sourceforge.net/tcl/tcl8.6.0-src.tar.gz
7.2 sudo tar xzvf tcl8.6.0-src.tar.gz -C /usr/local/
7.3 cd /usr/local/tcl8.6.0/unix/
7.4 sudo ./configure
7.5 sudo make
7.6 sudo make install
8. 安裝redis
8.1 wget http://download.redis.io/releases/redis-2.8.0.tar.gz
8.2 tar zxvf redis-2.8.0.tar.gz
8.3 cd redis-2.8.0.tar.gz/src
8.4 make
8.5 make install
8.6 ./redis-server &
9. 安裝deltarpm
9.1 yum provides '*/applydeltarpm'
9.2 yum install deltarpm
10. 安裝rabbitMq
10.1 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
10.2 sudo rpm -Uvh http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
10.1 wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-3.6.1-1.noarch.rpm
10.2 rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
10.5 yum install rabbitmq-server-3.6.1-1.noarch.rpm
網(wǎng)速太慢 先跳過
11 安裝postgresql
11.1 yum install -y postgresql-server;
11.2 service postgresql initdb
11.3 vi /var/lib/pgsql/data/pg_hba.conf 修改 local 的 peer為trust
11.4 service postgresql start; 啟動psql
11.5 su postgres; 更換postgres 用戶
11.6 psql -U postgres postgres
11.7 password 設(shè)置新密碼
11.8 create database "sentry"; 新建數(shù)據(jù)庫
11.9 q ; 退出
11.10 exit
12 安裝python環(huán)境設(shè)置
12.1 yum install -y gcc bzip2-devel.x86_64 sqlite-devel.x86_64 readline-devel.x86_64 libxslt-devel libffi-devel redis python-devel postgresql-devel*
12.2 wget http://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz;
12.3 tar -zxf Python-2.7.9.tgz;
12.4 cd Python-2.7.9;
12.5 ./configure --prefix=/usr/local/python2.7.9;
12.6 make
12.7 make install
12.8 cd
12.9 wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz --no-check-certificate;
12.10 tar zxvf distribute-0.6.49.tar.gz;
12.11 cd distribute-0.6.49
12.12 /usr/local/python2.7.9/bin/python setup.py install;
12.13 yum install python-setuptools
12.14 easy_install virtualenv
12.14 easy_install virtualenvwrapper
12.15 mkdir -p /data/server/python-envs
12.16 vi ~/.bashrc
后面添加內(nèi)容
export WORKON_HOME=/data/server/python-envs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/python2.7.9/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv
source /usr/bin/virtualenvwrapper.sh
12.16 source ~/.bashrc
12.17 mkvirtualenv sentry;
12.18 yum install libjpeg-turbo-devel
12.19 yum install openssl-devel
12.20 workon sentry
13 pip換源
13.1 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent
14 安裝sentry
14.1 pip install sentry
14.2 pip install sentry[postgres];
14.3 pip install sentry[postgres] --upgrade;
14.4 pip install gevent;
14.5 pip install eventlet;
15 環(huán)境設(shè)置
15.1 mkdir -p /data/server/sentry/etc;
15.2 sentry init /data/server/sentry/etc;
15.3 useradd sentry -s /sbin/nologin;
15.4 chown -Rf sentry:sentry /data/server/sentry/etc;
15.5 vi /data/server/sentry/etc/sentry.conf.py 修改postgres的用戶名和密碼
修正
/data/server/python-envs/sentry/lib/python2.7/site-packages/sentry/runner/initializer.py 的403 后面3行注釋掉
16 sentry啟動
16.1 sentry --config=/data/server/sentry/etc/sentry.conf.py upgrade; 創(chuàng)建 sentry用戶名密碼
16.2 export C_FORCE_ROOT="true"
16.3 sentry --config=/data/server/sentry/etc/sentry.conf.py run worker
16.4 遇到錯誤 UnicodeError
/data/server/python-envs/sentry/lib/python2.7/site-packages/sentry/db/postgres/helpers.py 引入代碼
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
16.5 sentry init
16.6 修改配置文件 /data/server/sentry/etc/sentry.conf.py 設(shè)置EMAIL(在最后添加)
設(shè)置postgres的數(shù)據(jù)庫密碼
EMAIL_HOST = 'smtp.qq.com'
EMAIL_HOST_PASSWORD = 'x162728'
EMAIL_HOST_USER = '674026565@qq.com'
EMAIL_PORT = 25
EMAIL_USE_TLS = True
16.6 sentry start
17 sentry 添加用戶
17.1 sentry --config=~/.sentry/sentry.conf.py createuser
部署成功之后的開啟過程
1 切換到root用戶
1.1 su
1.2 service postgresql start;
1.3 啟動redis redis-server &
1.4 workon sentry
1.5 source /data/server/python-envs/sentry/bin/activate
1.6 export C_FORCE_ROOT="true"
1.7 sentry run worker //開啟另外一個窗口
1.8 sentry start //正式啟動完成
額,還有一個1.9 別忘了關(guān)閉防火墻
1.9 sudo service firewalld stop