Mounting a
Automatically install a Linux command
Adapter 64-bit operating systems list:
Ubuntu 14.04、14.10、16.04、16.10
CentOS 7
由于 Linux 发行版较多,无法一一适配,如果不在以上列表中,请自行手动安装
installation
在安装之前,请自行更换apt、yum源
Open the terminal, the root user Shell, enter the following:
$ curl -sSL https://raw.githubusercontent.com/ysrc/xunfeng/master/install/install.sh | sh
Or enter the following command:
$ wget -qO- https://raw.githubusercontent.com/ysrc/xunfeng/master/install/install.sh | sh
Installed
after the installation of this script will start in the form of system service
starts service
$ /etc/init.d/xunfeng start
Out of service
/etc/init.d/xunfeng stop
# Restart Service
/etc/init.d/xunfeng restart
View services running status
/etc/init.d/xunfeng status
Installation two
Linux Installation Guide
Deploy and debug Xunfeng requires root privileges, switch to the root user account Ubuntu or Debian operating system is not turned on by default root, use the following command to open
$ sudo passwd root
After entering the root password of your own set
$ su root
You can switch to the root account
First, the installation environment
modify the current time zone is Asia / Shanghai:
# echo TZ\='Asia/Shanghai'\; export TZ >> ~/.bash\_profile && source ~/.bash\_profile
1.1 operating system relies on
CentOS
# yum install gcc libffi-devel python-devel openssl-devel libpcap-devel
Ubuntu/Debian
# apt-get update
# apt-get install gcc libssl-dev libffi-dev python-dev libpcap-dev
1.2 python dependencies
recommended pip management: The over-pip is not installed, run the following command to install:
# wget https://sec.ly.com/mirror/get-pip.py --no-check-certificate
# python get-pip.py
Pip update to the latest version:
# pip install -U pip
Use pip install python dependencies, watercress used here pypi source.
# pip install -r requirements.txt -i https://pypi.doubanio.com/simple/
1.3 install the database
due to the low version does not support full-text indexing, MongoDB version requires ≥ 3.2.
CentOS
# vi /etc/yum.repos.d/mongodb-org-3.2.repo
Edit yum source, enter the following:
[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=0
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
Save and exit, execute the following command:
# yum install -y mongodb-org
Ubuntu / Debian
reference address
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
# apt-get update && apt-get install -y mongodb-org
Ubuntu 12.04
# echo "deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list
Ubuntu 14.04
# echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list
Or download binary files directly run
https://sec.ly.com/mirror/mongodb-linux-x86_64-3.4.0.tgz
https://sec.ly.com/mirror/mongodb-linux-x86_64-ubuntu1604-3.4.0.tgz
https://sec.ly.com/mirror/mongodb-linux-x86_64-ubuntu1404-3.4.0.tgz
Second, the deployment and configuration
2.1 yum or apt way to start the installation mongodb the
default installation of these two methods mongodb will start automatically execute the following command to check whether mongodb started successfully:
# netstat -antlp | grep 27017
If no results are returned, execute:
# service mongod restart
或者
# /etc/init.d/mongod restart
And then perform a netstat command to see if the successful launch
2.2 download binary way to start the mongodb
If you are using direct download binary file to run, perform the following steps:
# mkdir /var/lib/mongodb/
Decompression mongodb
# wget https://sec.ly.com/mirror/mongodb-linux-x86_64-3.4.0.tgz
# tar -xvzf mongodb-linux-x86_64-3.4.0.tgz
# cd mongodb-linux-x86_64-3.4.0/bin/
# pwd
See value returned pwd performed, recorded (Example: /root/mongodb-linux-x86_64-3.4.0/bin/) add environmental variables
# ln -s /root/mongodb-linux-x86_64-3.4.0/bin/* /usr/bin/
Start mongodb
# cd ~/
# mongod --dbpath /var/lib/mongodb/
After the implementation of new create a new terminal for subsequent operations.
Whether to execute the following command to view mongodb successful start:
# netstat -antlp | grep 27017
2.3 mongodb add authentication
# mongo
> use xunfeng
> db.createUser({user:'scan',pwd:'your password',roles:[{role:'dbOwner',db:'xunfeng'}]})
> exit
Here's scan needs to be replaced and your password for your account and password mongodb.
2. Import database
into the db folder, run the following command:
# mongorestore -h 127.0.0.1 --port 27017 -d xunfeng .
If you are using the method in this document 2.1, perform
# service mongod stop
If you are using this document method 2.2, go back to the terminal ctrl + c to close the database
3. Modify the configuration
changes to the system database configuration script config.py:
class Config(object):
ACCOUNT = 'admin'
PASSWORD = 'xunfeng321'
Change the password in the PASSWORD field, set your password.
class ProductionConfig(Config):
DB = '127.0.0.1'
PORT = 27017
DBUSERNAME = 'scan'
DBPASSWORD = 'scanlol66'
DBNAME = 'xunfeng'
4. The operation of the system
after modification (corresponding to the required directory port and good) conifg.py run.sh file and the actual situation, the implementation of:
# sh run.sh
Reference connection:
https://github.com/ysrc/xunfeng/blob/master/docs/install/Linux.md
https://github.com/ysrc/xunfeng/blob/master/docs/install/Linux_AutoInstall.md