主机头

标题: SSBC 的DHT采集 最新一键包 [打印本页]

作者: admin    时间: 2017-3-3 01:46
标题: SSBC 的DHT采集 最新一键包
  1. #!/bin/bash
  2. #我本戏子 2016.8
  3. #changelog:
  4. #1.1添加开机自启动功能
  5. #1.2修改pip获取方式
  6. #1.3考虑到精简版系统的情况,自动安装wget与net-tools
  7. python -V         
  8. systemctl stop firewalld.service  
  9. systemctl disable firewalld.service   
  10. systemctl stop iptables.service  
  11. systemctl disable iptables.service  
  12. yum -y install wget
  13. #如果使用linode主机,请取消下面4行的注释
  14. #wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyuncs.com/repo/Centos-7.repo
  15. #wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  16. #yum clean metadata
  17. #yum makecache
  18. cd ~
  19. wget https://github.com/78/ssbc/archive/master.zip
  20. yum -y install unzip
  21. unzip master.zip
  22. #解压后 源码在/root/ssbc-master目录
  23. yum -y install gcc
  24. yum -y install gcc-c++
  25. yum -y install python-devel
  26. yum -y install mariadb
  27. yum -y install mariadb-devel
  28. yum -y install mariadb-server
  29. cd ssbc-master
  30. yum -y install epel-release
  31. yum -y install  python-pip
  32. pip install -r requirements.txt
  33. pip install  pygeoip
  34. systemctl start  mariadb.service
  35. mysql -uroot  -e"create database ssbc default character set utf8;"  
  36. sed -i '/!includedir/a\wait_timeout=2880000\ninteractive_timeout = 2880000\nmax_allowed_packet = 512M' /etc/my.cnf
  37. mkdir  -p  /data/bt/index/db /data/bt/index/binlog  /tem/downloads
  38. chmod  755 -R /data
  39. chmod  755 -R /tem
  40. yum -y install unixODBC unixODBC-devel postgresql-libs
  41. wget http://sphinxsearch.com/files/sphinx-2.2.9-1.rhel7.x86_64.rpm
  42. rpm -ivh sphinx-2.2.9-1.rhel7.x86_64.rpm
  43. systemctl restart mariadb.service  
  44. systemctl enable mariadb.service
  45. searchd --config ./sphinx.conf
  46. python manage.py makemigrations
  47. python manage.py migrate
  48. indexer -c sphinx.conf --all
  49. ps aux|grep searchd|awk '{print $2}'|xargs kill -9
  50. searchd --config ./sphinx.conf
  51. #启动网站并在后台运行
  52. nohup python manage.py runserver 0.0.0.0:80 >/dev/zero 2>&1&   
  53. yum -y install net-tools
  54. myip=`/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
  55. while true; do
  56.     read -p "确定浏览器能访问网站  http://$myip  吗?[y/n]" yn
  57.     case $yn in
  58.         [Yy]* ) cd workers; break;;
  59.         [Nn]* ) exit;;
  60.         * ) echo "请输入yes 或 no";;
  61.     esac
  62. done
  63. #运行爬虫并在后台运行
  64. nohup python simdht_worker.py >/dev/zero 2>&1&
  65. #定时索引并在后台运行
  66. nohup python index_worker.py >/dev/zero 2>&1&  
  67. cd ..
  68. python manage.py createsuperuser
  69. #开机自启动
  70. chmod +x /etc/rc.d/rc.local
  71. echo "systemctl start  mariadb.service " >> /etc/rc.d/rc.local
  72. echo "cd /root/ssbc-master " >> /etc/rc.d/rc.local
  73. echo "indexer -c sphinx.conf --all " >> /etc/rc.d/rc.local
  74. echo "searchd --config ./sphinx.conf " >> /etc/rc.d/rc.local
  75. echo "nohup python manage.py runserver 0.0.0.0:80 >/dev/zero 2>&1& " >> /etc/rc.d/rc.local
  76. echo "cd workers " >> /etc/rc.d/rc.local
  77. echo "nohup python simdht_worker.py >/dev/zero 2>&1& " >> /etc/rc.d/rc.local
  78. echo "nohup python index_worker.py >/dev/zero 2>&1& " >> /etc/rc.d/rc.local
复制代码





欢迎光临 主机头 (http://zhujitou.com/) Powered by Discuz! X2.5