主机头

 找回密码
 立即注册
查看: 814|回复: 0

SSBC 的DHT采集 最新一键包

[复制链接]

855

主题

2

好友

5271

积分

管理员

Rank: 9Rank: 9Rank: 9

发表于 2017-3-3 01:46:08 |显示全部楼层
  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
复制代码

感谢支持主机头,如果有问题可以联系我的QQ。目前提供各种服务。
网站建设,网站优化,美国VPS购买,VPS环境配置等。
目前通过本站购买VPS的话,可以免费帮忙配置环境。
付费提供DISCUZ PW DEDECMS技术支持。
www.www88.me
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

主机头版权声明|百度地图|谷歌地图|Archiver|手机版|主机头

GMT+8, 2019-7-20 09:37

Powered by Discuz! www.zhujitou.com

© 2001-2012 主机头.

回顶部