1. Cách để thay đổi tên máy chủ trên Debian?
Bước 1: Kiểm tra tên máy chủ với hostname.
$ hostname
olddog
Bạn cũng có thể sử dụng hostnamectl
.
$ hostnamectl
Static hostname: olddog
Icon name: computer-vm
Chassis: vm
Machine ID: 35ce0ea8e7e14d5da70beb7726f11df1
Boot ID: 5e03561d1ea54d20b9f39d686f64d4b7
Virtualization: qemu
Operating System: Debian GNU/Linux 9 (stretch)
Kernel: Linux 4.9.0-12-amd64
Architecture: x86-64
Bước 2: Thay đổi tên máy chủ
Thay đổi tên máy chủ thành newtricks .
$ sudo hostnamectl set-hostname newtricks
Bước 3: Cập nhật / etc / host
$ sudo nano /etc/hosts
Từ:
127.0.0.1 localhost
127.0.1.1 guest.guest guest
Đến:
127.0.0.1 localhost
127.0.1.1 newtricks.example.com newtricks
Bước 4: Xác nhận thay đổi
Kiểm tra sự thay đổi của bạn với hostnamectlvà hostname.
$ hostnamectl
Static hostname: newtricks
Icon name: computer-vm
Chassis: vm
Machine ID: 35ce0ea8e7e14d5da70beb7726f11df1
Boot ID: 5e03561d1ea54d20b9f39d686f64d4b7
Virtualization: qemu
Operating System: Debian GNU/Linux 9 (stretch)
Kernel: Linux 4.9.0-12-amd64
Architecture: x86-64
$ hostname
newtricks
$ hostname -f
newtricks.example.com
Bước 5: Cập nhật DNS
Tên máy chủ của bạn được thay đổi và sẵn sàng để sử dụng. Tuy nhiên bạn cần thực hiện các bước thay đổi lại DNS tại các công ty đăng ký tên miền.