# centos7和云vps维护

最小安装centos【注意,安装的时候,要把wifi开了,不然没有网络,还要弄好多配置】

最小安装的centos没vim,有vi 有python2.7.5

# 1.前置准备

# 新增用户

useradd -d /home/whoway -m whoway
useradd -d /home/hadoop -m hadoop
useradd -d /home/elastic -m elastic
1
2
3

# 使用root安装共享的软件

yum install lrzsz -y
yum install git -y
yum install wget -y
yum install tree -y
1
2
3
4

# 使用root安装大批量的常用开发工具-遇到的坑

[root@waywho ~]#  yum grouplist | grep Development
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
[root@waywho ~]# yum groups mark convert
已加载插件:fastestmirror
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Converted old style groups to objects.
[root@waywho ~]#  yum grouplist | grep Development
[root@waywho ~]# yum grouplist | grep Development
[root@waywho ~]# yum grouplist | grep development
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

中文导致的问题

[root@waywho ~]# yum grouplist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
可用的环境分组:
   最小安装
   基础设施服务器
   计算节点
   文件及打印服务器
   基本网页服务器
   虚拟化主机
   带 GUI 的服务器
   GNOME 桌面
   KDE Plasma Workspaces
   开发及生成工作站
已安装的组:
   系统管理工具
可用组:
   传统 UNIX 兼容性
   兼容性程序库
   图形管理工具
   安全性工具
   开发工具
   控制台互联网工具
   智能卡支持
   科学记数法支持
   系统管理
完成
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
  • 修改为英文。。
[root@waywho ~]# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
[root@waywho ~]# locale -a | grep en_US
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@waywho ~]# cat /etc/locale.conf
LANG="zh_CN.UTF-8"
[root@waywho ~]# vi /etc/locale.conf
[root@waywho ~]# cat /etc/locale.conf
LANG="en_US.UTF-8"

1
2
3
4
5
6

立马就生效了

[root@waywho ~]# yum grouplist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Available Environment Groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Installed Groups:
   System Administration Tools
Available Groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Scientific Support
   Security Tools
   Smart Card Support
   System Management
Done
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
  • 然后就可以了
[root@waywho ~]# yum grouplist | grep Development
   Development and Creative Workstation
   Development Tools
1
2
3
yum groupinstall 'Development Tools' -y
1
  • 这个命令会安装几十个工具,如git,gcc,perl,zip,svn,rsync等等,太方便了。
Installed:
  autoconf.noarch 0:2.69-11.el7                             automake.noarch 0:1.13.4-3.el7
  bison.x86_64 0:3.0.4-2.el7                                byacc.x86_64 0:1.9.20130304-3.el7
  cscope.x86_64 0:15.8-10.el7                               ctags.x86_64 0:5.8-13.el7
  diffstat.x86_64 0:1.57-4.el7                              doxygen.x86_64 1:1.8.5-4.el7
  elfutils.x86_64 0:0.176-5.el7                             flex.x86_64 0:2.5.37-6.el7
  gcc.x86_64 0:4.8.5-44.el7                                 gcc-c++.x86_64 0:4.8.5-44.el7
  gcc-gfortran.x86_64 0:4.8.5-44.el7                        git.x86_64 0:1.8.3.1-25.el7_9
  indent.x86_64 0:2.2.11-13.el7                             intltool.noarch 0:0.50.2-7.el7
  libtool.x86_64 0:2.4.2-22.el7_3                           patch.x86_64 0:2.7.1-12.el7_7
  patchutils.x86_64 0:0.3.3-5.el7_9                         rcs.x86_64 0:5.9.0-7.el7
  redhat-rpm-config.noarch 0:9.1.0-88.el7.centos            rpm-build.x86_64 0:4.11.3-48.el7_9
  rpm-sign.x86_64 0:4.11.3-48.el7_9                         subversion.x86_64 0:1.7.14-16.el7
  swig.x86_64 0:2.0.10-5.el7                                systemtap.x86_64 0:4.0-13.el7

Dependency Installed:
  apr.x86_64 0:1.4.8-7.el7                              apr-util.x86_64 0:1.5.2-6.el7_9.1
  avahi-libs.x86_64 0:0.6.31-20.el7                     boost-date-time.x86_64 0:1.53.0-28.el7
  boost-system.x86_64 0:1.53.0-28.el7                   boost-thread.x86_64 0:1.53.0-28.el7
  bzip2.x86_64 0:1.0.6-13.el7                           cpp.x86_64 0:4.8.5-44.el7
  dwz.x86_64 0:0.11-3.el7                               dyninst.x86_64 0:9.3.1-3.el7
  efivar-libs.x86_64 0:36-12.el7                        emacs-filesystem.noarch 1:24.3-23.el7_9.1
  gdb.x86_64 0:7.6.1-120.el7                            gettext-common-devel.noarch 0:0.19.8.1-3.el7
  gettext-devel.x86_64 0:0.19.8.1-3.el7                 glibc-devel.x86_64 0:2.17-326.el7_9.3
  glibc-headers.x86_64 0:2.17-326.el7_9.3               gnutls.x86_64 0:3.3.29-9.el7_6
  kernel-debug-devel.x86_64 0:3.10.0-1160.119.1.el7     kernel-headers.x86_64 0:3.10.0-1160.119.1.el7
  libdwarf.x86_64 0:20130207-4.el7                      libgfortran.x86_64 0:4.8.5-44.el7
  libmodman.x86_64 0:2.0.1-8.el7                        libmpc.x86_64 0:1.0.1-3.el7
  libproxy.x86_64 0:0.4.11-11.el7                       libquadmath.x86_64 0:4.8.5-44.el7
  libquadmath-devel.x86_64 0:4.8.5-44.el7               libstdc++-devel.x86_64 0:4.8.5-44.el7
  m4.x86_64 0:1.4.16-10.el7                             mokutil.x86_64 0:15-8.el7
  mpfr.x86_64 0:3.1.1-4.el7                             neon.x86_64 0:0.30.0-4.el7
  nettle.x86_64 0:2.7.1-9.el7_9                         pakchois.x86_64 0:0.4-10.el7
  perl.x86_64 4:5.16.3-299.el7_9                        perl-Carp.noarch 0:1.26-244.el7
  perl-Data-Dumper.x86_64 0:2.145-3.el7                 perl-Encode.x86_64 0:2.51-7.el7
  perl-Error.noarch 1:0.17020-2.el7                     perl-Exporter.noarch 0:5.68-3.el7
  perl-File-Path.noarch 0:2.09-2.el7                    perl-File-Temp.noarch 0:0.23.01-3.el7
  perl-Filter.x86_64 0:1.49-3.el7                       perl-Getopt-Long.noarch 0:2.40-3.el7
  perl-Git.noarch 0:1.8.3.1-25.el7_9                    perl-HTTP-Tiny.noarch 0:0.033-3.el7
  perl-PathTools.x86_64 0:3.40-5.el7                    perl-Pod-Escapes.noarch 1:1.04-299.el7_9
  perl-Pod-Perldoc.noarch 0:3.20-4.el7                  perl-Pod-Simple.noarch 1:3.28-4.el7
  perl-Pod-Usage.noarch 0:1.63-3.el7                    perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
  perl-Socket.x86_64 0:2.010-5.el7                      perl-Storable.x86_64 0:2.45-3.el7
  perl-TermReadKey.x86_64 0:2.30-20.el7                 perl-Test-Harness.noarch 0:3.28-3.el7
  perl-Text-ParseWords.noarch 0:3.29-4.el7              perl-Thread-Queue.noarch 0:3.02-2.el7
  perl-Time-HiRes.x86_64 4:1.9725-3.el7                 perl-Time-Local.noarch 0:1.2300-2.el7
  perl-XML-Parser.x86_64 0:2.41-10.el7                  perl-constant.noarch 0:1.27-2.el7
  perl-libs.x86_64 4:5.16.3-299.el7_9                   perl-macros.x86_64 4:5.16.3-299.el7_9
  perl-parent.noarch 1:0.225-244.el7                    perl-podlators.noarch 0:2.5.1-3.el7
  perl-srpm-macros.noarch 0:1-8.el7                     perl-threads.x86_64 0:1.87-4.el7
  perl-threads-shared.x86_64 0:1.43-6.el7               python-srpm-macros.noarch 0:3-34.el7
  rsync.x86_64 0:3.1.2-12.el7_9                         subversion-libs.x86_64 0:1.7.14-16.el7
  systemtap-client.x86_64 0:4.0-13.el7                  systemtap-devel.x86_64 0:4.0-13.el7
  systemtap-runtime.x86_64 0:4.0-13.el7                 trousers.x86_64 0:0.3.14-2.el7
  unzip.x86_64 0:6.0-24.el7_9                           zip.x86_64 0:3.0-11.el7

Complete!
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57

# 插曲-验证普通用户可以用:

我们的whoway也是可以用!

which sz
/usr/bin/sz

which git
/usr/bin/git
1
2
3
4
5

# 2.各自用户安装环境

# whoway用户

# go语言环境

wget https://github.com/fsgo/smart-go-dl/releases/download/v0.1.12/smart-go-dl_darwin_amd64
1

上面就可以下载smart-go-dl_darwin_amd64的可执行文件,然后借助它, 安装go ,然后才能webdav

[whoway@waywho ~]$ go env | grep GOPROXY
GOPROXY='https://proxy.golang.org,direct'
[whoway@waywho ~]$ go env -w GOPROXY=https://goproxy.cn,direct
[whoway@waywho ~]$ go env | grep GOPROXY
GOPROXY='https://goproxy.cn,direct'
1
2
3
4
5
go install github.com/fsgo/go_fmt/cmd/gorgeous@latest
go install honnef.co/go/tools/cmd/[email protected]
1
2

# 安装多版本java环境【JDK8和JDK11】

gu 故意叫多版本jdk

[whoway@waywho multi_jdk]$ ls
jdk-8u321-linux-x64.tar.gz  oracle_jdk8
[whoway@waywho multi_jdk]$ pwd
/home/whoway/.software/multi_jdk


vi /etc/profile

export JAVA_HOME=/home/whoway/.software/multi_jdk/oracle_jdk8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:{JAVA_HOME}/lib:${JRE_HOME}/lib:${CLASSPATH}
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=${PATH}:${JAVA_HOME}/bin
1
2
3
4
5
6
7
8
9
10
11
12
13
  • JDK11不一样
  • https://blog.csdn.net/weixin_44604118/article/details/122726962
export JAVA_HOME=/usr/local/java/jdk-11
export CLASSPATH=$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
1
2
3

# 安装elasticsearch

  • 失策了,因为elastic需要JDK环境【所以还是在whoway用户下安装】

# 集群名称,名字随便写,如果是集群模式需要所有的服务集群名称需要一致

cluster.name: test_cluster

# 节点名称

node.name: node-1

# 是否竞争主节点

node.master: true

# 是否存储数据

node.data: true #最大集群节点数 node.max_local_storage_nodes: 1

# 数据的默认存放路径

path.data: /usr/local/elasticsearch/data

# 日志的默认存放路径

path.logs: /usr/local/elasticsearch/logs

# 当前节点的IP地址,如果所有的服务器可以通过内网访问,则写内网即可,否则使用外网

network.host: 192.168.10.100

# 对外提供服务的端口,9300为集群服务的端口

http.port: 9200
transport.tcp.port: 9300

# 写入候选主节点的设备地址,在开启服务后可以被选为主节点

discovery.seed_hosts: ["192.168.10.100:9300"]

# 初始化一个新的集群时需要此配置来选举master

cluster.initial_master_nodes: ["node-1"]

# 避免出现跨域问题

http.cors.enabled: true http.cors.allow-origin: "*" http.cors.allow-headers: "Authorization" http.cors.allow-credentials: true

#注意:配置文件上方需要更改两个参数,在Memory下更改: bootstrap.memory_lock: false bootstrap.system_call_filter: false