Activate the web console with: systemctl enable --now cockpit.socket
Last failed login: Tue Dec 21 09:53:50 CST 2021 from 45.141.84.10 on ssh:notty There were 1917 failed login attempts since the last successful login. Last login: Mon Dec 20 22:48:55 2021 from 123.185.64.217 [root@cn-tx-bj7-c8 ~]#
改成非22端口防止爆破,并且在你云的防火墙放行新的端口,阻断默认22端口
1 2 3 4 5 6 7 8 9 10 11 12
[root@cn-tx-bj7-c8 ~]# vim /etc/ssh/sshd_config …… # If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # Port <rm> #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: …… [root@cn-tx-bj7-c8 ~]# systemctl restart sshd
[root@cn-tx-bj7-c8 ~]# systemctl enable --now fail2ban Created symlink /etc/systemd/system/multi-user.target.wants/fail2ban.service → /usr/lib/systemd/system/fail2ban.service. [root@cn-tx-bj7-c8 ~]# systemctl status fail2ban ● fail2ban.service - Fail2Ban Service Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2021-12-21 14:53:30 CST; 2s ago Docs: man:fail2ban(1) Process: 277792 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS) Main PID: 277794 (fail2ban-server) Tasks: 3 (limit: 23722) Memory: 10.7M CGroup: /system.slice/fail2ban.service └─277794 /usr/bin/python3.6 -s /usr/bin/fail2ban-server -xf start
Dec 21 14:53:30 cn-tx-bj7-c8 systemd[1]: Starting Fail2Ban Service... Dec 21 14:53:30 cn-tx-bj7-c8 systemd[1]: Started Fail2Ban Service. Dec 21 14:53:30 cn-tx-bj7-c8 fail2ban-server[277794]: Server ready
…… # "bantime" is the number of seconds that a host is banned. bantime = 1d
# A host is banned if it has generated "maxretry" during the last "findtime" # seconds. findtime = 10m
# "maxretry" is the number of failures before a host get banned. maxretry = 5 …… [sshd]
# To use more aggressive sshd modes set filter parameter "mode" in jail.local: # normal (default), ddos, extra or aggressive (combines all). # See "tests/files/logs/sshd" or "filter.d/sshd.conf" for usage example and details. enabled = true #mode = normal port = <rm> logpath = %(sshd_log)s backend = %(sshd_backend)s
最后就可以使用Fail2ban客户端查看状态了,是不是很简单?
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[root@cn-tx-bj7-c8 ~]# fail2ban-client status Status |- Number of jail: 1 `- Jail list: sshd [root@cn-tx-bj7-c8 ~]# fail2ban-client status sshd Status for the jail: sshd |- Filter | |- Currently failed: 4 | |- Total failed: 37071 | `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd `- Actions |- Currently banned: 170 |- Total banned: 3962 `- Banned IP list: <rm>
[root@cn-tx-bj7-c8 ~]# systemctl enable --now cockpit.socket Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket → /usr/lib/systemd/system/cockpit.socket. [root@cn-tx-bj7-c8 ~]# systemctl status cockpit.socket ● cockpit.socket - Cockpit Web Service Socket Loaded: loaded (/usr/lib/systemd/system/cockpit.socket; enabled; vendor preset: disabled) Active: active (listening) since Tue 2021-12-21 15:30:09 CST; 14s ago Docs: man:cockpit-ws(8) Listen: [::]:9090 (Stream) Process: 285185 ExecStartPost=/bin/ln -snf active.motd /run/cockpit/motd (code=exited, status=0/SUCCESS) Process: 285178 ExecStartPost=/usr/share/cockpit/motd/update-motd localhost (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 23722) Memory: 4.0K CGroup: /system.slice/cockpit.socket
Dec 21 15:30:09 cn-tx-bj7-c8 systemd[1]: Starting Cockpit Web Service Socket. Dec 21 15:30:09 cn-tx-bj7-c8 systemd[1]: Listening on Cockpit Web Service Socket. [root@cn-tx-bj7-c8 ~]# systemctl status cockpit ● cockpit.service - Cockpit Web Service Loaded: loaded (/usr/lib/systemd/system/cockpit.service; static; vendor preset: disabled) Active: inactive (dead) Docs: man:cockpit-ws(8)
[root@cn-tx-bj7-c8 ~]# vim /etc/mongod.conf # network interfaces net: port: 27017 bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
[root@cn-tx-bj7-c8 ~]# dnf info redis.x86_64 Last metadata expiration check: 0:00:03 ago on Fri 31 Dec 2021 09:23:34 PM CST. Available Packages Name : redis Version : 5.0.3 Release : 5.module_el8.4.0+955+7126e393 Architecture : x86_64 Size : 927 k Source : redis-5.0.3-5.module_el8.4.0+955+7126e393.src.rpm Repository : appstream Summary : A persistent key-value database URL : http://redis.io License : BSD and MIT Description : Redis is an advanced key-value store. It is often referred to as a data : structure server since keys can contain strings, hashes, lists, sets and : sorted sets. : : You can run atomic operations on these types, like appending to a string; : incrementing the value in a hash; pushing to a list; computing set : intersection, union and difference; or getting the member with highest : ranking in a sorted set. : : In order to achieve its outstanding performance, Redis works with an : in-memory dataset. Depending on your use case, you can persist it either : by dumping the dataset to disk every once in a while, or by appending : each command to a log. : : Redis also supports trivial-to-setup master-slave replication, with very : fast non-blocking first synchronization, auto-reconnection on net split : and so forth. : : Other features include Transactions, Pub/Sub, Lua scripting, Keys with a : limited time-to-live, and configuration settings to make Redis behave like : a cache. : : You can use Redis from most programming languages also.
[root@cn-tx-bj7-c8 ~]# wget https://download.redis.io/releases/redis-6.2.6.tar.gz [root@cn-tx-bj7-c8 ~]# tar xzf redis-6.2.6.tar.gz [root@cn-tx-bj7-c8 ~]# cd redis-6.2.6 [root@cn-tx-bj7-c8 redis-6.2.6]# make …… Hint: It's a good idea to run 'make test' ;) make[1]: Leaving directory '/root/redis-6.2.6/src' [root@cn-tx-bj7-c8 redis-6.2.6]# make test cd src && make test make[1]: Entering directory '/root/redis-6.2.6/src' CC Makefile.dep You need tcl 8.5 or newer in order to run the Redis test make[1]: *** [Makefile:391: test] Error 1 make[1]: Leaving directory '/root/redis-6.2.6/src' make: *** [Makefile:6: test] Error 2 [root@cn-tx-bj7-c8 redis-6.2.6]# make install cd src && make install make[1]: Entering directory '/root/redis-6.2.6/src' Hint: It's a good idea to run 'make test' ;)
Hello from Docker! This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/
For more examples and ideas, visit: https://docs.docker.com/get-started/ [root@cn-tx-bj7-c8 ~]# systemctl enable docker.service containerd.service Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service. Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /usr/lib/systemd/system/containerd.service.
并安装portainer可视化
1 2 3 4 5 6 7 8 9
[root@cn-tx-bj7-c8 ~]# docker pull portainer/portainer-ce:latest latest: Pulling from portainer/portainer-ce Digest: sha256:52f9fdee1e4acfb1b5c4ddd15c88905287efb6e8f8058d2c5a2543ddc72e9dc0 Status: Image is up to datefor portainer/portainer-ce:latest docker.io/portainer/portainer-ce:latest [root@cn-tx-bj7-c8 ~]# docker volume create portainer_data portainer_data [root@cn-tx-bj7-c8 ~]# docker run -d -p 9000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest 334877764accdc1068bef0663f8147e010838f001077fc1e4e3cd4f680d30ad1
[root@cn-py-dl-c8 ~]# yum install git -y [root@cn-py-dl-c8 ~]# git config --global -e [root@cn-py-dl-c8 ~]# git config --list fatal: bad config line 6 in file /root/.gitconfig [root@cn-py-dl-c8 ~]# vim .gitconfig [root@cn-py-dl-c8 ~]# git config --list user.name=yuangezhizao-serveraccount user.email=yuangezhizao@gmail.com http.https://github.com.proxy=socks5://192.168.25.248:1080 [root@cn-py-dl-c8 ~]# git clone https://github.com/yuangezhizao/mastodon.git [root@cn-py-dl-c8 ~]# cd mastodon/ [root@cn-py-dl-c8 mastodon]# git pull warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull:
git config pull.rebase false# merge (the default strategy) git config pull.rebase true# rebase git config pull.ff only # fast-forward only
You can replace "git config" with "git config --global" to set a default preference for all repositories. You can also pass --rebase, --no-rebase, or --ff-only on the command line to override the configured default per invocation.
[root@cn-py-dl-c8 mastodon]# docker-compose run --rm web bundle exec rake mastodon:setup Creating mastodon_web_run ... done Your instance is identified by its domain name. Changing it afterward will break things. Domain name: test.yuangezhizao.cn
Single user mode disables registrations and redirects the landing page to your public profile. Do you want to enable single user mode? No
Are you using Docker to run Mastodon? Yes
PostgreSQL host: db PostgreSQL port: 5432 Name of PostgreSQL database: mastodon_development Name of PostgreSQL user: mastodon Password of PostgreSQL user: Database configuration works! 🎆
Do you want to store uploaded files on the cloud? No
Do you want to send e-mails from localhost? No SMTP server: smtp.qq.com SMTP port: 465 SMTP username: yuangezhizao SMTP password: SMTP authentication: plain SMTP OpenSSL verify mode: none E-mail address to send e-mails "from": (Mastodon <notifications@test.yuangezhizao.cn>) yuangezhE-mail address to send e-mails "from": yuangezhizao@qq.com Send a test e-mail with this configuration right now? no
This configuration will be written to .env.production Save configuration? Yes Below is your configuration, save it to an .env.production file outside Docker:
# Generated with mastodon:setup on 2022-01-03 05:01:05 UTC …… SINGLE_USER_MODE=false …… SMTP_AUTH_METHOD=plain SMTP_OPENSSL_VERIFY_MODE=none ……
It is also saved within this container so you can proceed with this wizard.
Now that configuration is saved, the database schema must be loaded. If the database already exists, this will erase its contents. Prepare the database now? Yes Running `RAILS_ENV=production rails db:setup` ...
Created database 'mastodon_development' Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) Switching object-storage-safely from green to red because Redis::CannotConnectError Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) Done!
All done! You can now power on the Mastodon server 🐘
Do you want to create an admin user straight away? Yes Username: admin E-mail: root@yuangezhizao.cn Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) Switching object-storage-safely from green to red because Redis::CannotConnectError Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) You can login with the password: <rm> You can change your password once you login.
注 ①:sed -i "s/SECRET_KEY_BASE=$/&$(docker-compose run --rm web bundle exec rake secret)/" .env.production不可用,因为这个版本的代码中ruby打印一些warning导致sed报错-bash: /usr/bin/sed: Argument list too long 注 ②:记得最后输入Y,否则不会打印配置
1 2 3
This configuration will be written to .env.production Save configuration? no Nothing saved. Bye!
<header> <h1>Blocked host: localhost</h1> </header> <divid="container"> <h2>To allow requests to localhost, add the following to your environment configuration:</h2> <pre>config.hosts << "localhost"</pre> </div>
es_1 | ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes]; es_1 | Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes es_1 | at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) es_1 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) es_1 | at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) es_1 | at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:388) es_1 | at java.base/java.nio.file.Files.createDirectory(Files.java:694) es_1 | at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:801) es_1 | at java.base/java.nio.file.Files.createDirectories(Files.java:787) es_1 | at org.elasticsearch.env.NodeEnvironment.lambda$new$0(NodeEnvironment.java:275) es_1 | at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:212) es_1 | at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:272) es_1 | at org.elasticsearch.node.Node.<init>(Node.java:362) es_1 | at org.elasticsearch.node.Node.<init>(Node.java:289) es_1 | at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:227) es_1 | at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:227) es_1 | at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) es_1 | at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) es_1 | at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) es_1 | at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) es_1 | at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) es_1 | at org.elasticsearch.cli.Command.main(Command.java:90) es_1 | at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) es_1 | at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) es_1 | For complete error details, refer to the log at /usr/share/elasticsearch/logs/es-mastodon.log
[root@cn-tx-bj7-c8 mastodon]# docker-compose run --rm web bin/tootctl search deploy Creating mastodon_web_run ... done /opt/ruby/lib/ruby/2.7.0/net/protocol.rb:66: warning: already initialized constant Net::ProtocRetryError /opt/mastodon/vendor/bundle/ruby/2.7.0/gems/net-protocol-0.1.0/lib/net/protocol.rb:66: warning: previous definition of ProtocRetryError was here /opt/ruby/lib/ruby/2.7.0/net/protocol.rb:206: warning: already initialized constant Net::BufferedIO::BUFSIZE /opt/mastodon/vendor/bundle/ruby/2.7.0/gems/net-protocol-0.1.0/lib/net/protocol.rb:206: warning: previous definition of BUFSIZE was here /opt/ruby/lib/ruby/2.7.0/net/protocol.rb:503: warning: already initialized constant Net::NetPrivate::Socket /opt/mastodon/vendor/bundle/ruby/2.7.0/gems/net-protocol-0.1.0/lib/net/protocol.rb:503: warning: previous definition of Socket was here warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Using include_type_name in create index requests is deprecated. The parameter will be removed in the next major version." warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Using include_type_name in create index requests is deprecated. The parameter will be removed in the next major version." warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Specifying types in bulk requests is deprecated." warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Using include_type_name in create index requests is deprecated. The parameter will be removed in the next major version." warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Specifying types in bulk requests is deprecated." warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Using include_type_name in create index requests is deprecated. The parameter will be removed in the next major version." warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Specifying types in bulk requests is deprecated." warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Specifying types in bulk requests is deprecated." warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Specifying types in bulk requests is deprecated." warning: 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Specifying types in bulk requests is deprecated." 39/39 |=========================================================================| Time: 00:00:04 (9 docs/s) Indexed 39 records, de-indexed 0
services: wakapi: image: ghcr.io/muety/wakapi:2.2.5 #build: . ports: - 3333:3000 restart: always environment: # See README.md and config.default.yml for all config options WAKAPI_DB_TYPE: "postgres" WAKAPI_DB_NAME: "wakapi" WAKAPI_DB_USER: "wakapi" WAKAPI_DB_PASSWORD: "wakapi" WAKAPI_DB_HOST: "db" WAKAPI_DB_PORT: "5432" ENVIRONMENT: "prod"
db: image: postgres:12.3 environment: POSTGRES_USER: "wakapi" POSTGRES_PASSWORD: "wakapi" POSTGRES_DB: "wakapi" [root@cn-tx-bj7-c8 wakapi]# docker-compose up -d Pulling wakapi (ghcr.io/muety/wakapi:2.2.5)... 2.2.5: Pulling from muety/wakapi Digest: sha256:6a9ac9cce93c0fc3256dde7865c54ec4121979ad3091dbf851110ebec01f9a54 Pulling db (postgres:12.3)... 12.3: Pulling from library/postgres Digest: sha256:a06e6e6e519b7a329c419f8221edec66cfc45511e8b80e262c12103ba745cf19 Status: Downloaded newer image for postgres:12.3 Creating wakapi_db_1 ... done Creating wakapi_wakapi_1 ... done
然后又出现新的报错了草
1 2 3 4 5 6 7
wakapi_1 | 2022-03-16T16:31:06.180468706Z [INFO ] potentially running migration '20220313-index_generation_hint' db_1 | 2022-03-16 16:31:06.180 UTC [73] ERROR: relation "key_string_values" does not exist at character 15 db_1 | 2022-03-16 16:31:06.180 UTC [73] STATEMENT: SELECT * FROM "key_string_values" WHERE key = $1 ORDER BY "key_string_values"."key" LIMIT 1 wakapi_1 | 2022-03-16T16:31:06.180835365Z [INFO ] please note: the following migrations might take a few minutes, as column types are changed and new indexes are created, have some patience db_1 | 2022-03-16 16:31:06.181 UTC [73] ERROR: relation "key_string_values" does not exist at character 13 db_1 | 2022-03-16 16:31:06.181 UTC [73] STATEMENT: INSERT INTO "key_string_values" ("key","value") VALUES ($1,$2) wakapi_1 | 2022-03-16T16:31:06.181352991Z [ERROR] failed to mark migration 20220313-index_generation_hint as run - ERROR: relation "key_string_values" does not exist (SQLSTATE 42P01)
[root@cn-tx-bj7-c8 fpm]# docker-compose up -d Creating network "fpm_default" with the default driver Creating volume "fpm_db" with default driver Creating volume "fpm_nextcloud" with default driver Pulling db (postgres:alpine)... alpine: Pulling from library/postgres Digest: sha256:dfd144937916a40521248f82c7e1acdcdfd0bf79db20ebc91f25f6842c689322 Status: Downloaded newer image for postgres:alpine Pulling redis (redis:alpine)... alpine: Pulling from library/redis Digest: sha256:609765f7b8f4fc3dc27f0a90698733c6aa6cc98d6829162794967322496dadb8 Status: Downloaded newer image for redis:alpine Pulling app (nextcloud:fpm-alpine)... fpm-alpine: Pulling from library/nextcloud fpm-alpine: Pulling from library/nextcloud Digest: sha256:641e9c554b23268179c0d1ce390401e824be3cd86dd17410b52bcc8a49865ea0 Status: Downloaded newer image for nextcloud:fpm-alpine Building web Sending build context to Docker daemon 10.24kB Step 1/2 : FROM nginx:alpine alpine: Pulling from library/nginx Digest: sha256:77cc350019d0188d3115084265483dcefdd8489ccf719ff4e4c956b48de8ff6a Status: Downloaded newer image for nginx:alpine ---> 7d73f57a7cf7 Step 2/2 : COPY nginx.conf /etc/nginx/nginx.conf ---> 1d8afd4ecaea Successfully built 1d8afd4ecaea Successfully tagged fpm_web:latest WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. Creating fpm_db_1 ... done Creating fpm_redis_1 ... done Creating fpm_cron_1 ... done Creating fpm_app_1 ... done Creating fpm_web_1 ... done
0x18.Failed to download metadata for repo 'appstream'
1 2 3
[root@cn-tx-bj7-c8 ~]# dnf update -y CentOS Linux 8 - AppStream 32 B/s | 38 B 00:01 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
[AppStream] name=Qcloud-$releasever - AppStream baseurl=http://mirrors.tencentyun.com/centos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Qcloud-8 [root@cn-tx-bj7-c8 yum.repos.d]# cat CentOS-Linux-AppStream.repo # CentOS-Linux-AppStream.repo # # The mirrorlist system uses the connecting IP address of the client and the # update status of each mirror to pick current mirrors that are geographically # close to the client. You should use this for CentOS updates unless you are # manually picking other mirrors. # # If the mirrorlist does not work for you, you can try the commented out # baseurl line instead.
解决方法是注释mirrorlist,然后使用http://vault.centos.org替换baseurl 也可以使用红帽官方提供的一键脚本 sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*
[root@cn-tx-bj7-c8 yum.repos.d]# cat CentOS-Linux-AppStream.repo # CentOS-Linux-AppStream.repo # # The mirrorlist system uses the connecting IP address of the client and the # update status of each mirror to pick current mirrors that are geographically # close to the client. You should use this for CentOS updates unless you are # manually picking other mirrors. # # If the mirrorlist does not work for you, you can try the commented out # baseurl line instead.
[appstream] name=CentOS Linux $releasever - AppStream #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra baseurl=http://vault.centos.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [root@cn-tx-bj7-c8 yum.repos.d]# cat CentOS-Linux-BaseOS.repo # CentOS-Linux-BaseOS.repo # # The mirrorlist system uses the connecting IP address of the client and the # update status of each mirror to pick current mirrors that are geographically # close to the client. You should use this for CentOS updates unless you are # manually picking other mirrors. # # If the mirrorlist does not work for you, you can try the commented out # baseurl line instead.
We’re making CentOS Stream the collaboration hub for RHEL, with the landscape looking like this:
Fedora Linux is the place for major new operating system innovations, thoughts, and ideas - essentially, this is where the next major version of Red Hat Enterprise Linux is born.
CentOS Stream is the continuously delivered platform that becomes the next minor version of RHEL.
RHEL is the intelligent operating system for production workloads, used in nearly every industry in the world, from cloud-scale deployments in mission-critical data centers and localized server rooms to public clouds and out to far-flung edges of enterprise networks.
[root@cn-tx-bj7-c8 ~]# su - postgres Last failed login: Sat Apr 23 09:51:23 CST 2022 from 144.91.101.39 on ssh:notty There were 28 failed login attempts since the last successful login. [postgres@cn-tx-bj7-c8 ~]$ psql psql (14.2) Type "help"forhelp.
postgres=# alter user postgres with password '<rm>'; ALTER ROLE postgres=# \q
修改配置文件/var/lib/pgsql/14/data/postgresql.conf,开启外网访问listen_addresses = '*' 再修改配置文件/var/lib/pgsql/14/data/pg_hba.conf追加host all all 0.0.0.0/0 md5 最后重启即可systemctl restart postgresql-14 修改PG默认数据存储路径,自默认的SSD盘移至新购的大容量HDD盘
[root@cn-tx-bj7-c8 ~]# mkdir /data/pgsql [root@cn-tx-bj7-c8 ~]# cp -r /var/lib/pgsql/14/data/* /data/pgsql [root@cn-tx-bj7-c8 ~]# chown -R postgres:postgres /data/pgsql [root@cn-tx-bj7-c8 ~]# chmod 700 /data/pgsql [root@cn-tx-bj7-c8 ~]# vim /var/lib/pgsql/14/data/postgresql.conf data_directory = '/data/pgsql' [root@cn-tx-bj7-c8 ~]# vim /usr/lib/systemd/system/postgresql-14.service Environment=PGDATA=/data/pgsql/ [root@cn-tx-bj7-c8 ~]# systemctl start postgresql-14 [root@cn-tx-bj7-c8 ~]# psql psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "root" does not exist [root@cn-tx-bj7-c8 ~]# su - postgres Last login: Sat Apr 23 17:54:03 CST 2022 on pts/0 Last failed login: Sat Apr 23 20:21:04 CST 2022 from 125.162.251.218 on ssh:notty There was 1 failed login attempt since the last successful login. [postgres@cn-tx-bj7-c8 ~]$ psql psql (14.2) Type "help"forhelp.
postgres=# show data_directory; data_directory ---------------- /data/pgsql (1 row)
#skip-grant-tables [mysql] # 数据库默认字符集 default-character-set=utf8mb4 [root@cn-tx-bj7-c8 mysql_for_docker]# cat docker-compose.yml # Use root/example as user/password credentials version: '3.1'
services:
db: image: mysql:5.7.38 # NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password # (this is just an example, not intended to be a production configuration) # privileged: true restart: always ports: - "3306:3306" command: # --wait_timeout=31536000 # --interactive_timeout=31536000 --max_connections=100 --default-authentication-plugin=mysql_native_password environment: MYSQL_ROOT_PASSWORD: <rm> TZ: Asia/Shanghai volumes: - /data/mysql:/var/lib/mysql - /root/mysql_for_docker/config:/etc/mysql/conf.d networks: - internal_network - external_network
[root@cn-tx-bj7-c8 config]# docker exec -it 6e48563b9576 /bin/bash root@6e48563b9576:/# mysql -uroot -p<rm> mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.38 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.
mysql> exit Bye root@6e48563b9576:/# exit exit [root@cn-tx-bj7-c8 config]# docker exec -it 6e48563b9576 /bin/bash root@6e48563b9576:/# mysql -uroot -p<rm> mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.38 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.