Initial commands on fresh linux

Moki Lv6

General

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
apt update && \
apt install -yqq fail2ban ufw && \
DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -yqq install sshpass tzdata curl wget screen rsync htop iotop iftop vim parallel nfs-client powertop jq fonts-lato git sshfs tmux ncdu psmisc fail2ban && \
cat <<EOF | sudo tee -a /etc/profile
export PS1="\[\033[34m\][\D{%Y-%m-%d} \t] \[\033[1;32m\]\u@\h:\[\033[1;34m\]\w\[\033[37m\]\e[m\n$ "
export PS0="\e[33m>>> \\\$(date +%Y-%m-%d\ %T.%3N)\e[0m\\\\n\\\${t:0:\\\$((t=\\\$(date +%s%N),0))}"
export PROMPT_COMMAND='history -a && (( t )) && ( echo -en "\e[33m<<< \$(date +%Y-%m-%d\ %T.%3N)" ; printf ", Seconds: %d.%09ds, Status: \$?\\\n" \$((t=\$(date +%s%N)-t,t/1000000000)) \$((t%1000000000)) ; echo -en "\e[0m") ; t=0 ; '\$PROMPT_COMMAND
EOF && \
cat <<EOF | sudo tee -a /root/.bashrc
PS1="\[\033[34m\][\D{%Y-%m-%d} \t] \[\033[1;31m\]\u@\h:\[\033[1;34m\]\w\[\033[37m\]\e[m\n$ "
export PS0="\e[33m>>> \\\$(date +%Y-%m-%d\ %T.%3N)\e[0m\\\\n\\\${t:0:\\\$((t=\\\$(date +%s%N),0))}"
export PROMPT_COMMAND='history -a && (( t )) && ( echo -en "\e[33m<<< \$(date +%Y-%m-%d\ %T.%3N)" ; printf ", Seconds: %d.%09ds, Status: \$?\\\n" \$((t=\$(date +%s%N)-t,t/1000000000)) \$((t%1000000000)) ; echo -en "\e[0m") ; t=0 ; '\$PROMPT_COMMAND
EOF && \
mkdir -p /root/.config/htop/ && \
cat > /root/.config/htop/htoprc <<EOF && \
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=-1
tree_sort_key=0
tree_sort_direction=1
hide_kernel_threads=1
hide_userland_threads=1
shadow_other_users=1
show_thread_names=1
show_program_path=1
highlight_base_name=1
highlight_megabytes=1
highlight_threads=1
highlight_changes=0
highlight_changes_delay_secs=5
find_comm_in_cmdline=1
strip_exe_from_cmdline=1
show_merged_command=0
tree_view=1
tree_view_always_by_pid=1
header_margin=1
detailed_cpu_time=0
cpu_count_from_one=0
show_cpu_usage=1
show_cpu_frequency=0
show_cpu_temperature=0
degree_fahrenheit=0
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=0
enable_mouse=1
delay=15
left_meters=LeftCPUs2 CPU Memory Swap DiskIO NetworkIO
left_meter_modes=1 1 1 1 2 2
right_meters=RightCPUs2 Tasks LoadAverage Uptime Hostname
right_meter_modes=1 2 2 2 2
hide_function_bar=0
EOF
echo 'ok'

Docker

1
2
3
4
5
6
7
8
9
10
11
12
13
apt-get update && \
apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release && \
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update && \
apt-get install -y docker-ce docker-ce-cli containerd.io && \
curl -L https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose && \
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose && \
mkdir -p /usr/local/lib/docker/cli-plugins && \
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose && \
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose && \
echo 'ok'
On this page
Initial commands on fresh linux