新服部署备忘
1 2
| sudo yum update sudo yum -y install gcc make gcc-c++ openssl-devel wget
|
1 2 3 4 5 6 7 8 9 10 11 12 13
| sudo yum -y install mariadb*
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
sudo mysql_secure_installation
sudo mysql -uroot -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'passward' WITH GRANT OPTION;
flush privileges;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| sudo vim /etc/yum.repos.d/mongodb-org-3.2.repo
[mongodb-org-3.2] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.2/x86_64/ gpgcheck=0 enabled=1
sudo yum install -y mongodb-org
sudo systemctl start mongod.service sudo systemctl enable mongod.service sudo systemctl stop mongod.service
sudo mkdir /data/db sudo mkdir /data/db/mongo sudo rsync -av /var/lib/mongo /data/db/mongo/
sudo vim /etc/mongod.conf
dbPath: /data/db/mongo/mongo
|
- Cent OS 7上需要把mongoDB添加到systemd,否则会出现下面的错误
systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| sudo vim /usr/lib/systemd/system/mongod.service
[Unit] Description=mongodb database [Service] User=mongod Group=mongod Environment="OPTIONS=--quiet -f /etc/mongod.conf" ExecStart=/usr/bin/mongod $OPTIONS run PIDFile=/var/run/mongodb/mongod.pid [Install] WantedBy=multi-user.target
sudo ln -s /usr/lib/systemd/system/mongod.service /etc/systemd/system/multi-user.target.wants/ sudo systemctl daemon-reload
|