1 下载与解压
在官网下载mongodb安装包
tar -zxvf mongodb-linux-x86_64-ubuntu1604-3.4.0.tgz
2 移动安装文件
sudo mv mongodb-linux-x86_64-ubuntu1604-3.4.0 /usr/local/mongodb
3 添加环境变量
sudo vim /etc/profile
最后一行添加
export PATH=/usr/local/mongodb/bin:$PATH
保存退出
source /etc/profile
查看环境变量
echo $PATH
4 添加配置文件
sudo vim /etc/mongod.conf
verbose = true
port = 27017
logpath = /var/log/mongodb/mongodb.log
logappend = true
dbpath = /var/lib/mongodb/db
directoryperdb = true
auth = false
fork = true
quiet =true
5 创建目录文件
sudo mkdir /var/log/mongodb/
sudo mkdir /var/lib/mongodb/db -p
sudo touch /var/log/mongodb/mongodb.log
6 编辑启动项下的文件
sudo vim /etc/init.d/mongodb
. /lib/lsb/init-functions
PROGRAM=/usr/local/mongodb/bin/mongod
MONGOPID=`ps -ef | grep 'mongod' | grep -v grep | awk '{print $2}'`
test -x $PROGRAM || exit 0
case "$1" in
start)
ulimit -n 3000
log_begin_msg "Starting MongoDB server"
$PROGRAM -f /etc/mongod.conf
log_end_msg 0
;;
stop)
log_begin_msg "Stopping MongoDB server"
if [ ! -z "$MONGOPID" ]; then
kill -15 $MONGOPID
fi
log_end_msg 0
;;
status)
;;
*)
log_success_msg "Usage: /etc/init.d/mongodb {start|stop|status}"
exit 1
esac
exit 0
7 修改权限与更新
sudo chmod +x /etc/init.d/mongodb
sudo update-rc.d mongodb defaults
8 mongodb的启动与关闭
sudo service mongodb start
sudo service mongodb stop
python 3.6安装
安装python3.6
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
cd /usr/bin
ls | grep python
sudo rm python
sudo ln -s python3.6m python
sudo apt-get install python3-pip
sudo python pip install --upgrade pip
pip --version
mysql安装
安装
sudo apt-get install mysql-server
mysql -u root -p 登录数据库
开启root用户的全称访问权限
use mysql
update user set host="%" where user = 'root'
grant all privileges on *.* to 'root'@'%' identified by '密码'
flush privileges
quit
修改mysql.conf的ip绑定
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
将bind-address =127.0.0.1修改为bind-address =0.0.0.0
保存退出
重启及关闭
sudo service mysql start 启动
sudo service mysql stop 关闭
sudo service mysql restart 重启