RedHad 7.x服务器操作记录

2022-05-06 20:16:34 浏览数 (1)

(1)查看版本和内核

代码语言:javascript复制
[root@master ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.3 (Maipo)
[root@master ~]# uname -a
Linux master 3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@master ~]#

(2)查看磁盘空间

代码语言:javascript复制
[root@master ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   50G  7.9G   39G  17% /
devtmpfs                      3.9G     0  3.9G   0% /dev
tmpfs                         3.9G   84K  3.9G   1% /dev/shm
tmpfs                         3.9G  8.9M  3.9G   1% /run
tmpfs                         3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                     477M  141M  307M  32% /boot
/dev/mapper/datavg-lv_data   98G   61M   93G   1% /data
tmpfs                         783M   16K  783M   1% /run/user/42
tmpfs                         783M     0  783M   0% /run/user/0
[root@master ~]# df -h /data
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/datavg-lv_data   98G   61M   93G   1% /data
[root@master ~]#

(3)查看内存信息

代码语言:javascript复制
[root@master ~]# free
              total        used        free      shared  buff/cache   available
Mem:        8010812      296244     6499536        9164     1215032     7424964
Swap:       8388604           0     8388604
[root@master ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           6           0           1           7
Swap:             7           0           7
[root@master ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           7823         289        6346           8        1186        7250
Swap:          8191           0        8191
[root@master ~]#

(4)删除已安装JDK

代码语言:javascript复制
[root@master ~]# rpm -qa|grep java
tzdata-java-2016g-2.el7.noarch
java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
python-javapackages-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
javapackages-tools-3.4.1-11.el7.noarch
[root@master ~]# rpm -qa|grep java|xargs rpm -e --nodeps
[root@master ~]# rpm -qa|grep java
[root@master ~]#

(5)从yum源中搜索软件包

代码语言:javascript复制
[root@master ~]# yum search mariadb
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
============================================================= N/S matched: mariadb ==============================================================
mariadb-bench.x86_64 : MariaDB benchmark scripts and data
mariadb-devel.i686 : Files for development of MariaDB/MySQL applications
mariadb-devel.x86_64 : Files for development of MariaDB/MySQL applications
mariadb-libs.i686 : The shared libraries required for MariaDB/MySQL clients
mariadb-libs.x86_64 : The shared libraries required for MariaDB/MySQL clients
mariadb-server.x86_64 : The MariaDB server and related files
mariadb.x86_64 : A community developed branch of MySQL
mariadb-test.x86_64 : The test suite distributed with MariaD

  Name and summary matches only, use "search all" for everything.
[root@bigdata05-test ~]#

(6)创建用户和组

代码语言:javascript复制
[root@master ~]# groupadd elastic
[root@master ~]# useradd elastic -g elastic

需要单独设置密码(elastic)

代码语言:javascript复制
[root@master ~]# passwd elastic
Changing password for user elastic.
New password: 
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password: 
passwd: all authentication tokens updated successfully.

将用户加入sudoers文件

代码语言:javascript复制
[root@master ~]# visudo

在root下添一行

代码语言:javascript复制
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
elastic ALL=(ALL)       ALL

切换用户

代码语言:javascript复制
[root@master ~]# su elastic
[elastic@master root]$ sudo ls /root
[sudo] password for elastic: 
anaconda-ks.cfg
[elastic@master root]$

(7)更改目录宿主

代码语言:javascript复制
[root@master ~]# chown -R elastic:elastic /opt/elasticsearch-6.2.3
[root@master ~]# ll /opt/elasticsearch-6.2.3/
total 236
drwxr-xr-x  2 elastic elastic   4096 Apr  8 11:21 bin
drwxr-xr-x  2 elastic elastic   4096 Mar 13 18:08 config
drwxr-xr-x  2 elastic elastic   4096 Mar 13 18:08 lib
-rw-r--r--  1 elastic elastic  11358 Mar 13 18:02 LICENSE.txt
drwxr-xr-x  2 elastic elastic   4096 Mar 13 18:08 logs
drwxr-xr-x 16 elastic elastic   4096 Mar 13 18:08 modules
-rw-r--r--  1 elastic elastic 191887 Mar 13 18:07 NOTICE.txt
drwxr-xr-x  2 elastic elastic   4096 Mar 13 18:08 plugins
-rw-r--r--  1 elastic elastic   9268 Mar 13 18:02 README.textile
[root@master ~]#
[root@master ~]# ll /opt | grep elastic
drwxr-xr-x   8 elastic elastic 4096 Mar 13 18:08 elasticsearch-6.2.3
[root@master ~]#
代码语言:javascript复制
[root@master config]# vi elasticsearch.yml
[root@master config]# mkdir /tpdata/elasticsearch
[root@master config]# mkdir /var/log/elasticsearch 
[root@master config]# chown -R elastic:elastic /tpdata/elasticsearch
[root@master config]# chown -R elastic:elastic /var/log/elasticsearch
代码语言:javascript复制
[root@master ~]# tar -zxvf kibana-6.4.3-linux-x86_64.tar.gz -C /opt
[root@master ~]# mv /opt/kibana-6.4.3-linux-x86_64/ /opt/kibana-6.4.3
[root@master ~]# chown -R elastic:elastic /opt/kibana-6.4.3
[root@master ~]# ll /opt/kibana-6.4.3/
total 2288
drwxr-xr-x    2 elastic elastic    4096 Oct 31 07:48 bin
drwxrwxr-x    2 elastic elastic    4096 Oct 31 07:43 config
drwxrwxr-x    2 elastic elastic    4096 Oct 31 07:29 data
-rw-rw-r--    1 elastic elastic   13675 Oct 31 07:32 LICENSE.txt
drwxrwxr-x    6 elastic elastic    4096 Oct 31 07:46 node
drwxrwxr-x 1131 elastic elastic   36864 Oct 31 07:44 node_modules
-rw-rw-r--    1 elastic elastic 1575254 Oct 31 07:31 NOTICE.txt
drwxrwxr-x    3 elastic elastic    4096 Oct 31 07:43 optimize
-rw-rw-r--    1 elastic elastic     748 Oct 31 07:32 package.json
drwxrwxr-x    2 elastic elastic    4096 Oct 31 07:29 plugins
-rw-rw-r--    1 elastic elastic    5309 Oct 31 07:29 README.txt
drwxr-xr-x   15 elastic elastic    4096 Oct 31 07:43 src
drwxr-xr-x    2 elastic elastic    4096 Oct 31 07:43 webpackShims
-rw-r--r--    1 elastic elastic  666636 Oct 31 07:24 yarn.lock
[root@master ~]# 

0 人点赞