Skip to content
Roman edited this page Jul 18, 2019 · 7 revisions

Первичная настройка linux-сервера на CentOS 7+ (отсюда)

Обновления ядра CentOS

По умолчанию в CentOS 7 стоит ядро 3.10, надо обновить до 4.x

https://www.cyberciti.biz/faq/how-to-install-latest-kernel-on-centos-linux-7-using-yum-command/

wget https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
gpg --quiet --with-fingerprint RPM-GPG-KEY-elrepo.org
sudo rpm --import RPM-GPG-KEY-elrepo.org
yum install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm (external link)
yum list available --disablerepo='*' --enablerepo=elrepo-kernel
yum --disablerepo='*' --enablerepo=elrepo-kernel install kernel-lt

Далее нужно установить загрузку по умолчанию

grep '^menuentry' /boot/grub2/grub.cfg
## Выбираем нужный и стачим значнеие
grub2-reboot 0
reboot

Проверка

uname -sr
Linux 4.4.185-1.el7.elrepo.x86_64

Добавление нового пользователя

# User
adduser srv
passwd srv
gpasswd -a srv wheel

Выйти с сервера и на локальной машине сделать:

# ssh keys
ssh-copy-id srv@SERVER_IP

Установка Docker:

sudo yum check-update
curl -fsSL https://get.docker.com/ | sh
sudo systemctl start docker
sudo systemctl status docker

sudo usermod -aG docker $(whoami)

Дальше надо разлогиниться и зайти снова

Проверка:

docker info
docker run hello-world

Настройки файрвола посмотреть тут

Как посмотреть версию ядра?

uname -r
-a, --all                print all information
-s, --kernel-name        print the kernel name
-n, --nodename           print the network node hostname
-r, --kernel-release     print the kernel release
-v, --kernel-version     print the kernel version
-m, --machine            print the machine hardware name
-p, --processor          print the processor type or "unknown"
-i, --hardware-platform  print the hardware platform or "unknown"
-o, --operating-system   print the operating system
--help                   display this help and exit
--version                output version information and exit
Clone this wiki locally