2023-06-07 21:09:32 +08:00
|
|
|
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
|
|
|
|
|
|
|
|
# configure repository
|
|
|
|
system_info:
|
|
|
|
package_mirrors:
|
|
|
|
- arches: [i386, amd64]
|
|
|
|
failsafe:
|
2023-06-08 04:15:09 +08:00
|
|
|
primary: http://targetLinuxMirror/ubuntu
|
2023-06-07 21:09:32 +08:00
|
|
|
security: http://security.ubuntu.com/ubuntu
|
|
|
|
- arches: [armhf, armel, default]
|
|
|
|
failsafe:
|
2023-06-08 04:15:09 +08:00
|
|
|
primary: http://targetLinuxMirror/ubuntu-ports
|
|
|
|
security: http://targetLinuxMirror/ubuntu-ports
|
2023-06-07 21:09:32 +08:00
|
|
|
|
|
|
|
# configure hostname
|
2023-06-08 02:23:22 +08:00
|
|
|
hostname: HostName
|
2023-06-07 21:09:32 +08:00
|
|
|
|
2023-06-14 04:58:03 +08:00
|
|
|
# configure localization
|
|
|
|
locale: en_US.UTF-8
|
|
|
|
|
2023-06-14 05:18:08 +08:00
|
|
|
# configure timezone
|
2023-06-08 02:29:28 +08:00
|
|
|
timezone: TimeZone
|
|
|
|
|
2023-06-07 21:09:32 +08:00
|
|
|
# configure root user
|
|
|
|
users:
|
|
|
|
- name: root
|
|
|
|
lock_passwd: false
|
|
|
|
shell: /bin/bash
|
|
|
|
|
|
|
|
chpasswd:
|
|
|
|
expire: false
|
|
|
|
list: |
|
2023-06-08 02:42:29 +08:00
|
|
|
root:tmpWORD
|
2023-06-07 21:09:32 +08:00
|
|
|
users:
|
|
|
|
- name: root
|
2023-06-08 02:23:22 +08:00
|
|
|
password: tmpWORD
|
2023-06-07 21:09:32 +08:00
|
|
|
type: text
|
|
|
|
|
|
|
|
# configure network
|
|
|
|
network:
|
2023-06-08 11:01:13 +08:00
|
|
|
version: 2
|
|
|
|
ethernets:
|
|
|
|
eth0:
|
|
|
|
dhcp4: true
|
|
|
|
dhcp6: true
|
2023-06-07 21:09:32 +08:00
|
|
|
|
|
|
|
# later commands
|
|
|
|
runcmd:
|
2023-06-08 02:23:22 +08:00
|
|
|
- sed -ri 's/^#?Port.*/Port sshPORT/g' /etc/ssh/sshd_config
|
2023-06-07 21:09:32 +08:00
|
|
|
- sed -ri 's/^#?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
|
|
|
|
- sed -ri 's/^#?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
|
|
|
- update-rc.d ssh enable
|
|
|
|
- /etc/init.d/ssh restart
|
2023-06-17 07:27:49 +08:00
|
|
|
- sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'a'"'"';/g' /etc/needrestart/needrestart.conf
|
2023-06-07 21:09:32 +08:00
|
|
|
- apt update
|
2023-06-15 22:22:13 +08:00
|
|
|
- apt install dnsutils fail2ban file lrzsz net-tools traceroute unzip vim wget xz-utils -y
|
2023-06-17 01:33:04 +08:00
|
|
|
- sed -ri 's/set compatible/set nocompatible/g' /etc/vim/vimrc.tiny
|
|
|
|
- sed -ri '/set nocompatible/a\set backspace=2' /etc/vim/vimrc.tiny
|
2023-06-08 17:30:17 +08:00
|
|
|
- mv /etc/netplan/50-cloud-init.yaml /etc/netplan/20-netcfg.yaml
|
|
|
|
- netplan apply
|
2023-06-14 04:58:03 +08:00
|
|
|
- rm -rf /etc/cloud/cloud.cfg.d/99-fake_cloud.cfg
|
2023-06-08 20:06:38 +08:00
|
|
|
- touch /etc/cloud/cloud-init.disabled
|
2023-06-07 21:09:32 +08:00
|
|
|
|
|
|
|
# configure cloud-init for NoCloud
|
|
|
|
datasource_list: [ NoCloud, None ]
|