阿里云IaaS部署流程
安装postgresql:
sudo apt-get install postgresql
sudo -u postgres psql
以下内容内容都是在 postgres=# 下输入
ALTER USER postgres WITH PASSWORD '123456'; # 密码设置为123455,有分号才会执行命令
\q #退出客户端
sudo -u postgres passwd
postgresql目录迁移:
sudo -u postgres psql
SHOW data_directory;
sudo systemctl stop postgresql
sudo systemctl status postgresql
sudo rsync -av 原始路径 目标路径 (sudo rsync -av /var/lib/postgresql /mnt/volume-nyc1-01)
备份
sudo mv /var/lib/postgresql/9.5/main /var/lib/postgresql/9.5/main.bak
sudo nano /etc/postgresql/9.5/main/postgresql.conf
. . .
data_directory = '/mnt/volume-nyc1-01/postgresql/9.5/main'
. . .
sudo systemctl start postgresql
sudo systemctl status postgresql
postgresql远程访问:
vim /etc/postgresql/版本号/main/postgresql.conf
listen_addresses = '*'
vim /etc/postgresql/版本号/main/pg_hba.conf
host all all 0.0.0.0/0 md5
重启服务
sudo service postgresql restart
postgresql 最新版
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
sudo apt update
sudo apt install postgresql
安装glances:
apt-get install glances
安装docker:
curl -sSL https://get.daocloud.io/docker | sh
systemctl enable docker.service
安装redis:
sudo apt-get install redis-server
设置远程访问
sudo vi /etc/redis/redis.conf
注释掉绑定地址#bind 127.0.0.1
daemonize yes
protected-mode no #将yes改为no
RabbitMQ安装:
sudo apt-get install erlang-nox
sudo apt-get update
sudo apt-get install rabbitmq-server
启动、停止、重启、状态rabbitMq命令
sudo rabbitmq-server start
sudo rabbitmq-server stop
sudo rabbitmq-server restart
sudo rabbitmqctl status
RabbitMQ web管理接口
启用rabbitmq-management插件:
sudo rabbitmq-plugins enable rabbitmq_management
elasticsearch安装:
sudo apt update
sudo apt install apt-transport-https ca-certificates wget
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
sudo apt update
sudo apt install elasticsearch
sudo systemctl enable --now elasticsearch.service
cd /usr/share/elasticsearch/
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.16.2/elasticsearch-analysis-ik-7.16.2.zip
elasticsearch配置远程访问
修改配置文件/config/elasticsearch.yml
在network的地方设置以下三个配置
network.bind_host: 0.0.0.0
network.publish_host: elasticsearch所在的主机的ip
http.port: 9200
在discovery的地方,取消下面这个配置的注释
cluster.initial_master_nodes: ["node-1","node-2"]
重启
service elasticsearch restart
sonarqube 安装:
docker pull sonarqube
sudo -u postgres psql
CREATE DATABASE sonarqube WITH ENCODING = 'UTF8';
CREATE USER sonarqube WITH PASSWORD 'sonarqube';
GRANT ALL PRIVILEGES ON DATABASE sonarqube TO sonarqube;
GRANT ALL PRIVILEGES ON all tables in schema public TO sonarqube;
docker run --name sonarqube -d sonarqube:latest
docker cp dc8d9832aee7:/opt/sonarqube/extensions /docker/sonarqube/
docker cp dc8d9832aee7:/opt/sonarqube/conf /docker/sonarqube/
docker stop dc8d9832aee7
docker rm dc8d9832aee7
docker run --name sonarqube -p 9002:9000 -p 9092:9092 -e SONAR_JDBC_URL="jdbc:postgresql://172.16.4.250:5432/sonarqube?useUnicode=true&characterEncoding=utf-8" -e SONAR_JDBC_USERNAME="sonarqube" -e SONAR_JDBC_PASSWORD="sonarqube" -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -v /docker/sonarqube/conf:/opt/sonarqube/conf -v /docker/sonarqube/data:/opt/sonarqube/data -v /docker/sonarqube/logs:/opt/sonarqube/logs -v /docker/sonarqube/extensions:/opt/sonarqube/extensions -d sonarqube:latest
docker update --restart=always sonarqube
ftp设置:
sudo apt-get update
sudo apt-get install vsftpd
mkdir /home/ftp
mkdir /home/ftp/data
sudo chown nobody:nogroup /home/ftp
chmod -R 777 /home/ftp/data
useradd ftpuser -g ftp -d /home/ftp -s /sbin/nologin
passwd ftpuser
vim /etc/vsftpd.conf
移除 chroot_local_user=YES 前面的注释
新增如下内容:
user_sub_token=ftpuser
local_root=/home/ftp, 可自行定制,并修改 FTP 根目录
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
vim /etc/vsftpd.userlist
新增如下内容
ftpuser
harbor安装:
1.安装docker
2.安装docker-compose
下载地址:https://github.com/docker/compose/releases
sudo curl -L "https://github.com/docker/compose/releases/download/最新版本/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo curl -L https://get.daocloud.io/docker/compose/releases/download/最新版本/docker-compose-uname -s
-uname -m
> /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
mkdir -p docker/compose
docker-compose -v
3.安装harbor
下载harbor
下载地址:https://github.com/goharbor/harbor/releases
解压:tar -xvf harbor-online-installer-v2.5.1.tgz
修改文件执行命令:cp haorbor.yml.tmpl harbor.yml
编辑文件:vim harbor.yml
修改 harbor.yml 中 hostname字段 配置为本机IP ,端口改成9980(避免80端口被其它程序占用)
把https块注释掉
执行安装
sudo ./install.sh
启动
docker-compose up -d
vim /etc/docker/daemon.json
客户端docker需要修改配置文件,添加:
{
"insecure-registries": ["服务器IP:端口"]
}