Linux Server Cloud

Linux Server Cloud

第一部分. initial config

  1. Proxy setting
1
2
3
4
5
6
7
# set proxy - vi /etc/profile .bashrc

export proxy="http://192.168.56.1:2080"
export http_proxy=$proxy
export https_proxy=$proxy
export ftp_proxy=$proxy
export no_proxy="localhost, 127.0.0.1, ::1, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8"
  1. DNF default init
1
2
3
# dnf config & install
dnf update -y
dnf install -y vim curl wget git net-tools openssh-server tar bzip2
  1. add ssh pubkeys
1
2
# add rsa.pub to .ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDCSlwmt3d+4g24cS2nWZfrRpOoYlAREqUJh6sZBdxvY1m4xMW4+K3PFbfw5h4+zYJDb+ijs8VAaIOlxooqCCJkSci+x+7MGgQqZHdgEBMtyCjd2VqGbWHfyfWOypACIT4sC9n1gmRO7iETDWRsFoNSaO6383VQbBu20MSdwvBQ1luBiqDRyxk3bEf8gGRo9GXSclKtQkcmiq/JmRNMHD42lrrLFHAp0UCsjbFni5EbD1ei5tUYwDW1gWnAqBsc+lfMdwoUOSbCR+U1yWAMxvCTCbb4YqHNVNL/Kw6GNEsMv/8jtm1Mshf8O1u2/+u7veVh8FbaRd5W2MCCi+VHU1OZxyIfOT0MqwT1feRPyu7JaNGf/ilF3HFofEOvatRB3D4anJo4s21w1J3U6301bW/r+iSYPDfOp/EX5JNXvvcDaaIPNbLImkypTapzR2JYAa7uqJzVZlG9qoX1adkGKt/A/yFr19SGeTjE7fW2TQtFjGmUaPhC2cbXNb1W3f3m2JM= dyson@DESKTOP-LQH83SN
  1. 关闭防火墙
1
2
systemctl disable firewalld
systemctl stop firewalld

第二部分. install pkgs

  1. install to /usr/local/pkg from binary
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# install go java nodejs conda
wget https://go.dev/dl/go1.22.6.linux-amd64.tar.gz
wget https://repo.anaconda.com/archive/Anaconda3-2024.06-1-Linux-x86_64.sh
wget https://download.oracle.com/java/22/latest/jdk-22_linux-x64_bin.tar.gz
wget https://nodejs.org/dist/v20.16.0/node-v20.16.0-linux-x64.tar.xz

mkdir /usr/local/pkg
tar -C /usr/local/pkg -xzf go1.22.6.linux-amd64.tar.gz
tar -C /usr/local/pkg -xzf jdk-22_linux-x64_bin.tar.gz
tar -C /usr/local/pkg -xf node-v20.16.0-linux-x64.tar.xz
sh Anaconda3-2024.06-1-Linux-x86_64.sh

vim /etc/profile
export PATH=$PATH:/usr/local/pkg/go/bin
export PATH=$PATH:/usr/local/pkg/jdk-22.0.2/bin
export PATH=$PATH:/usr/local/pkg/node-v20.16.0-linux-x64/bin
reboot
  1. install dbs from repo
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# install mariadb postgresql redis mongodb 

wget https://repo.mongodb.org/yum/redhat/9/mongodb-org/7.0/x86_64/RPMS/mongodb-org-server-7.0.12-1.el9.x86_64.rpm

dnf install -y mariadb-server postgresql-server redis
dnf install ./mongodb-org-server-7.0.12-1.el9.x86_64.rpm

/usr/bin/postgresql-setup --initdb

systemctl enable mariadb postgresql redis mongod
systemctl start mariadb postgresql redis mongod
  1. install docker from repo
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
dnf update -y
dnf install -y dnf-plugins-core
dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo

dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

mkdir -p /etc/systemd/system/docker.service.d
vim /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]
Environment="HTTP_PROXY=http://192.168.56.1:2080/"
Environment="HTTPS_PROXY=http://192.168.56.1:2080/"
Environment="NO_PROXY=localhost,127.0.0.1"

systemctl daemon-reload
systemctl start docker
systemctl enable docker

systemctl show --property=Environment docker
  1. install nginx from repo
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
vim /etc/yum.repos.d/nginx.repo

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/rhel/9/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/rhel/9/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

dnf install nginx

systemctl start nginx
systemctl enable nginx
systemctl status nginx

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

# 用于允许 Apache HTTP 服务器(即 Nginx 或 httpd)通过网络连接到外部服务
setsebool -P httpd_can_network_connect 1 # 关闭selinux
  1. install jenkins from repo
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key

dnf install fontconfig java-17-openjdk -y
dnf install jenkins -y

systemctl daemon-reload

systemctl status jenkins
systemctl enable jenkins
systemctl start jenkins

cat /var/lib/jenkins/secrets/initialAdminPassword

# 配置代理服务器
location /jenkins/ {
    proxy_pass http://localhost:12080/jenkins/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

systemctl edit jenkins

[Service]
Environment="JENKINS_PREFIX=/jenkins"
Environment="JENKINS_PORT=12080"
systemctl restart jenkins
  1. install GitLab in another host
1
2
3
4
5
6
7
8
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
EXTERNAL_URL="http://192.168.56.105" dnf install -y gitlab-ce

vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.56.105'

gitlab-ctl reconfigure
cat /etc/gitlab/initial_root_password
  1. install NextCloud from docker
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
vim /etc/nginx/conf.d/default.conf

location /nextcloud/ {
    rewrite ^/nextcloud(/.*)$ $1 break;
    proxy_pass http://127.0.0.1:11000;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Accept-Encoding "";
    proxy_set_header Host $host;

    client_body_buffer_size 512k;
    proxy_read_timeout 86400s;
    client_max_body_size 0;

    # Websocket
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
}

docker pull nextcloud/all-in-one:latest

ip route add 192.168.56.0/24 via 172.17.0.1

docker run --init --sig-proxy=false --name nextcloud-aio-mastercontainer --restart always --publish 8080:8080 --env HTTP_PROXY=http://192.168.56.1:2080 --env HTTPS_PROXY=http://192.168.56.1:2080 --env APACHE_PORT=11000 --env APACHE_IP_BINDING=0.0.0.0  --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config --volume /var/run/docker.sock:/var/run/docker.sock:ro nextcloud/all-in-one:latest

sudo docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 80:80 \
--publish 8080:8080 \
--publish 8443:8443 \
--env HTTP_PROXY=http://192.168.56.1:2080 \
--env HTTPS_PROXY=http://192.168.56.1:2080 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
nextcloud/all-in-one:latest
Licensed under CC BY-NC-SA 4.0
最后更新于 Oct 19, 2024 02:17 UTC