参考1:linux 硬盘分区,分区,删除分区,格式化,挂载,卸载笔记
参考2:分区实践
Docker社区版(CE)(免费)
Docker企业版(EE)(付费)
安装依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
设置docker源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
生成yum缓存
yum makecache fast
安装
yum install -y docker-ce
设置docker开机自启
systemctl enable docker
启动
systemctl start docker
查看启动状态,active (running)为启动状态
systemctl status docker
添加国内镜像pull路径(没有时新建该文件)
vim /etc/docker/daemon.json
{"registry-mirrors": ["https://alzgoonw.mirror.aliyuncs.com","http://f1361db2.m.daocloud.io"]}
docker服务重启
systemctl restart docker
查看镜像源是否添加成功
docker info
上传(安装)docker-compose
下载链接
/usr/local/bin/docker-compose
更改权限为可执行
chmod +x docker-compose
在/rssp/code/下解压docker镜像
下载链接
cd /rssp/code/
tar -xzf docker-redis.tar.gz
tar -xzf docker-mongo.tar.gz
tar -xzf docker-nginx-sz.tar.gz
修改yml文件
启动容器(需要在docker-compose.yml目录启动)
docker-compose up -d
查看容器启动成功没有
docker ps
启动容器
docker-compose up -d
/rssp/code/docker-nginx/
docker-compose up -d nginx-api
docker-compose up -d nginx-api-2
出现启动失败情况:
可以看到是9901端口被占用了,docker ps -a查看是否有其它容器占用该端口
查看所有端口的使用情况 netstat -ntlp
可以看到9901端口被pm2占用了
在配置文件docker-compose.yml
中修改端口
安装nvm(node.js版本管理工具)
在/etc/hosts 文件添加以下内容
199.232.68.133 raw.githubusercontent.com
下载
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
wget命令出现Unable to establish SSL connection.
#加上跳过验证证书的参数
wget -O- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh –no-check-certificate| bash
执行命令加载nvm
source ~/.bashrc
nvm设置淘宝镜像
echo -e "\nexport NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node" >> ~/.bashrc
source ~/.bashrc
nvm ls
nvm install v10.19.0
node -v
npm安装
npm config set registry https://registry.npm
npm install pm2 -g
#安装失败则换为淘宝镜像
npm config set registry https://registry.npm.taobao.org
pm2 list
cnpm安装
npm install cnpm -g --registry=https://registry.npm.taobao.org
本地安装MongoDB
yum install -y mongodb-org-tools-4.0.21
若无则创建mongodb-org-4.0.repo
vim /etc/yum.repos.d/mongodb-org-4.0.repo
写入
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
安装mongo工具和mongoshell
yum install -y mongodb-org-tools-4.0.21
yum install -y mongodb-org-shell-4.0.21
验证mongo安装以及初始化
mongo -port 27017 #访问本地mongo,等同于mongo
mongo -port 27018 #访问服务端mongo
本地mongo初始化
> show dbs
2021-02-18T09:12:10.294+0800 E QUERY [js] Error: listDatabases failed:{
"operationTime" : Timestamp(0, 0),
"ok" : 0,
"errmsg" : "not master and slaveOk=false",
"code" : 13435,
"codeName" : "NotMasterNoSlaveOk",
"$clusterTime" : {
"clusterTime" : Timestamp(0, 0),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:151:1
shellHelper.show@src/mongo/shell/utils.js:882:13
shellHelper@src/mongo/shell/utils.js:766:15
@(shellhelp2):1:1
> rs.initiate()
{
"info2" : "no configuration specified. Using a default configuration for the set",
"me" : "86927e4b754f:27017",
"ok" : 1,
"operationTime" : Timestamp(1613610753, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1613610753, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
rs:SECONDARY> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
rs:PRIMARY>
官网安装链接
直接安装完整版mongo
mongod:服务端,启动mongo进程
mongo:客户端,连接mongodb
#直接安装前需要配置mongodb-org-4.0.repo
yum install -y mongodb-org
配置db目录为磁盘挂载目录
vim /etc/mongod.conf
启动mongod(服务端),设置自启动
systemctl start mongod
systemctl status mongod
systemctl enable mongod
# 若没有mongod.service则需要创建一个
vim /lib/systemd/system/mongod.service
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network.target
[Service]
User=mongod
Group=mongod
Environment="OPTIONS=-f /etc/mongod.conf"
EnvironmentFile=-/etc/sysconfig/mongod
ExecStart=/usr/bin/mongod $OPTIONS
ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb
ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb
ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb
PermissionsStartOnly=true
PIDFile=/var/run/mongodb/mongod.pid
Type=forking
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
Restart=always
RestartSec=2
StartLimitInterval=0
# Recommended limits for for mongod as specified in
# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
[Install]
WantedBy=multi-user.target
安装redis
yum install redis
ImageMagic
Ubuntu:apt-get install imagemagick
Centos:yum install ImageMagick
海外服务器还需要安装sysstat
apt-get install sysstat