配置安裝
- 環(huán)境Ubuntu 22
//注釋所有
# vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
//更新
# apt update
- 靜態(tài)IP配置
# vim /etc/netplan/00-installer-config.yaml
- 額外硬盤(pán)掛載
sudo fdisk -l
mount /dev/sdb /d
-
/etc/fstab
文件添加
# /dev/sdb /d ext4 defaults 0 0
# mount -a
# df -h
# lsblk
- 磁盤(pán)擴(kuò)容
# vgdisplay //看/目錄名稱(chēng)
# lvextend -L 10T /dev/mapper/ubuntu--vg-ubuntu--lv # 增加至 10 G
# lvextend -L +10G /dev/mapper/ubuntu--vg-ubuntu--lv # 再增加 10 G
# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
SSH修改
# vim /etc/ssh/sshd_config
ClientAliveInterval 50
ClientAliveCountMax 3
文件安裝
JDK1.8
apt install openjdk-8-jdk
版本驗(yàn)證
# java -version
# javac -version
MongoDB4.4
# sudo apt-get install gnupg curl
# echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
# curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-4.4.gpg \
--dearmor
# echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
# apt update
# apt list | grep mongodb-org
# apt list -a mongodb-org
# apt-get install libssl1.1
# apt install mongodb-org
- 配置文件
/etc/mongod.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /home/mongod/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
wiredTiger:
engineConfig:
cacheSizeGB: 0.3
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /home/mongod/log/mongodb/mongod.log
# network interfaces
net:
port: 端口
bindIp: 0.0.0.0
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
security:
authorization: enabled #此處要開(kāi)啟
setParameter:
enableLocalhostAuthBypass: true
authenticationMechanisms: SCRAM-SHA-1
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network-online.target
Wants=network-online.target
[Service]
User=mongodb
Group=mongodb
EnvironmentFile=-/home/mongod
Environment="MONGODB_CONFIG_OVERRIDE_NOFORK=1"
ExecStart=/usr/bin/mongod --config /home/mongod/mongod.conf
RuntimeDirectory=mongodb
# 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
# Recommended limits for mongod as specified in
# https://docs.mongodb.com/manual/reference/ulimit/#recommended-ulimit-settings
[Install]
WantedBy=multi-user.target
- 文件夾權(quán)限設(shè)定
# chown -R mongod:mongod mongod
- 命令配置
# mongo --port 端口
# use admin
# db.createUser({user:"用戶(hù)",pwd:"密碼",roles:["root"]})
# show users;
- 刪除用戶(hù)
//命令
# use admin
# db.dropUser('username');
- 權(quán)限劃分
# use 使用的數(shù)據(jù),非admin;
# db.createUser({user:"鏈接用戶(hù)",pwd:"鏈接密碼",roles:[{ role: "userAdmin", db: "數(shù)據(jù)名稱(chēng)" },{ role: "dbAdmin", db: "數(shù)據(jù)名稱(chēng)" },{ role: "dbOwner", db: "數(shù)據(jù)名稱(chēng)" }]})
# db.createUser({user: "用戶(hù)",pwd: "密碼",roles: ["readWrite"]})
- 登錄
# use admin;
# db.auth("用戶(hù)","密碼")
Redis5
# wget http://download.redis.io/releases/redis-5.0.10.tar.gz
# tar xzf redis-5.0.10.tar.gz
# cd redis-5.0.10
# make && make install
- make安裝
# apt install build-essential tcl
# apt install make
# apt install pkg-config
# make distclean //失敗后屿笼,清除命令
# make install
-
.serivce
配置
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
Type=notify
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /home/redis/redis.conf --supervised systemd
ExecStop=/usr/local/bin/redis-cli shutdown
#Restart=always
[Install]
WantedBy=multi-user.target
- 配置文件
bind 0.0.0.0
protected-mode yes
port 端口
tcp-backlog 511
timeout 0
tcp-keepalive 60
supervised no
pidfile /home/redis/run/redis_6379.pid
loglevel notice
logfile /home/redis/log/redis/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
rdbchecksum yes
dir /home/redis/lib/redis
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
requirepass 秘鑰
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
Nginx
# apt install nginx
Mysql8
# apt install mysql8
- 文件配置
# vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 端口 bind地址等
# 開(kāi)啟log
server-id= 1
log_bin= /var/log/mysql/mysql-bin.log
max_binlog_size=1G
binlog_format=ROW
# log_bin_trust_function_creators=1 //是否創(chuàng)建函數(shù)腥例,有函數(shù)不啟用會(huì)報(bào)錯(cuò)
- 命令配置
# mysql
# show databases;
# use mysql;
# show tables;
# update user set host='%' where host = 'localhost';
# 老版本
# mysql -u root
# ALTER USER 'root'@'%' IDENTIFIED BY '秘鑰';
# 8版本
# mysql -u root -p
# ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'new_password';
# FLUSH PRIVILEGES;
rabbitmq
# apt install rabbitmq
# cd /usr/lib/systemd/system
默認(rèn)不會(huì)創(chuàng)建
rabbitmq.conf
配置文件,訪問(wèn)官方鏈接狡忙,手動(dòng)配置文件開(kāi)啟圖形化界面默認(rèn)端口
15672
# rabbitmq-plugins enable rabbitmq_management
- 用戶(hù)配置
# rabbitmqctl add_user admin 秘鑰
# rabbitmqctl set_user_tags admin administrator
# rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
# rabbitmqctl set_virtual_host_limits / arguments={"rabbitmq_management", [], true}
# rabbitmqctl list_permissions -p /
# rabbitmqctl delete_user guest //刪除用戶(hù)
emqx4.4.15
# curl -s https://assets.emqx.com/scripts/install-emqx-deb.sh | sudo bash
# apt update
# apt-cache madison emqx
# apt install emqx=4.4.15
# 配置文件
# vim /etc/emqx/plugins/emqx_dashboard.conf
nodejs安裝v16.14.0
# curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
# apt list -a nodejs
# apt install nodejs=16.14.0
# node -v
mariadb-server
# apt list -a mariadb-server
mariadb-server/jammy-security,jammy-updates 1:10.6.18-0ubuntu0.22.04.1 all
# apt install -y mariadb-server
- 配置文件
cd /etc/mysql/mariadb.conf.d
,其中*-server.cnf
- 修改內(nèi)容
bind-address = 0.0.0.0
址芯,port = 30000
灾茁。port沒(méi)有則新增 - 是否配置binlog,注意
binlog_format=ROW
- 操作
# mysql
# show databases;
# use mysql;
# show tables;
# GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '秘鑰';
# FLUSH PRIVILEGES;