-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebian_install.txt
394 lines (326 loc) · 9.9 KB
/
debian_install.txt
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
Debian Linux install
# download the first .iso ("*-DVD-1.iso"): debian-12.1.0-amd64-DVD-1.iso ,
# avoid download security packages on slow network connection durign installation.
# enable network but unplug or disconnect network cable for fast installation.
# virtualbox network: Bridged Adapter,
# clone virtual machine in virtualbox,
# generate new MAC addresses for all network adapters.
# add the debian installation image .iso file in cdrom, install from cdrom.
$ apt-cdrom add
Using CD-ROM mount point /media/cdrom/
$
# E: The repository 'cdrom://[Debian GNU/Linux 12.7.0] bookworm Release' does not have a Release file.
# add: [trusted=yes]
#
$ cat /etc/apt/sources.list
deb [trusted=yes] cdrom:[Debian GNU/Linux 12.7.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20240831-10:40]/ bookworm contrib main non-free-firmware
$
$ apt list
$
$ su -c "apt install sudo"
$ grep sudo /etc/group
$ su -c "/usr/sbin/usermod -a -G sudo `whoami`"
$ sg sudo
$ groups
sudo
$
$ apt install sudo openssh-server build-essential gdb cmake automake autoconf libtool pkg-config gettext manpages-dev
$
$ ls /sys/class/net/
ens33
$
$ ip addr
$
# without desktop environment
# https://wiki.debian.org/NetworkConfiguration ,
# iface ens33 inet dhcp
$ vi /etc/network/interfaces
auto ens33
allow-hotplug ens33
iface ens33 inet static
address 192.168.1.2/24
gateway 192.157.1.1
$
$ /usr/sbin/ifup ens33
$ /usr/sbin/ifdown ens33
$ ethtool ens33
$
# "No DHCP client software found!"
# reboot to take effect.
# gnome desktop
# method=auto
$ vi /etc/NetworkManager/system-connections/ens33.nmconnection
[ipv4]
address1=192.168.1.5/24,192.168.1.1
dns=192.168.1.1;8.8.8.8;
method=manual
$
$ systemctl restart NetworkManager
$
# dns
$ vi /etc/resolv.conf
nameserver 192.168.1.1
nameserver 8.8.8.8
$
$ ping debian.org
$
$ grep -i Codename /etc/os-release
$
$ lsb_release -a | grep -i codename
Codename: bookworm
$
# https://wiki.debian.org/DebianUnstable ,
# https://wiki.debian.org/DebianTesting ,
# Change your apt sources to point to "unstable", or "testing",
# apt update ; apt full-upgrade ;
# https://www.debian.org/mirror/list.html ,
# https://mirrors.tuna.tsinghua.edu.cn/help/debian/ ,
# https://mirror.nyist.edu.cn/help/debian/ ,
# deb822 format, debian 12 or later,
$ vi /etc/apt/sources.list.d/debian.sources
Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
Suites: bookworm bookworm-updates bookworm-backports
#Suites: testing
#Suites: sid
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
# security section is not available for sid (unstable).
Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian-security
Suites: bookworm-security
#Suites: testing-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
$
# older foramt,
$ vi /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/debian bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
$
$ vi /etc/apt/sources.list
deb https://mirror.nyist.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirror.nyist.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirror.nyist.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirror.nyist.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
$
$ apt update
$ apt upgrade
$ apt full-upgrade # testing, sid (unstable): build-essential c++ gcc g++,
$ apt autoremove
$
# c++ program compiled on sid(unstable), testing with dynamical link, does not run on stable,
# ./main: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by ./main)
# use fully static link with -static instead,
$ vi ~/.inputrc # readline
set editing-mode vi
$
# environment variables in ~/.profile, eg. PATH
$ vi ~/.bashrc
alias ls="ls --color=never"
alias tree="tree -n"
EDITOR=/usr/bin/vi
export HISTCONTROL="ignoredups:erasedups:ignorespace"
export PROMPT_COMMAND='history -a'
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../boost_1_73_0/stage/lib
export PATH=$PATH:../boost_1_73_0/stage/lib
PS1='\$ '
set -o vi # set editing-mode vi # ~/.inputrc,
stty -ixon # terminal flow control Ctrl-S conflicts with vim, emacs.
#stty columns 80
ulimit -c unlimited # systemd-coredump
$
$ touch ~/.hushlogin
$
$ apt install vim # vim-tiny pre-installed
$ update-alternatives --config editor
$ vi -u ~/.vimrc ~/.vimrc
set hlsearch
set incsearch
set nowrapscan
"syntax off
$
$ apt list --installed | grep vim
$
# list content of installed package
$ dpkg -L vim
/usr/bin/vim
$
# which installed package has the file
$ dpkg -S /usr/bin/vim
vim: /usr/bin/vim
$
$ apt install apt-file
$ apt-file update
$
# package content
$ apt-file list vim
vim: /usr/bin/vim
$
# package contains a file
$ apt-file --package-only search /usr/bin/vim
gcc
$
$ apt install openssh-server samba
$ systemctl enable ssh smbd nmbd
$ systemctl start ssh smbd nmbd
$ smbpasswd -a `whoami`
$ vi /etc/samba/smb.conf
[homes]
read only = no
create mask = 0755
directory mask = 0755
$
# LeakSanitizer does not work under ptrace (strace, gdb)
# Address Sanitizer (asan) will report memory usage problems
# by running a program built with asan. do not run it in a debugger.
$ apt install build-essential
$ apt install gdb # gdb-minimal in installation image .iso
$ apt install cmake
$ apt install automake autoconf libtool pkg-config gettext
$ apt install gcc-doc gdb-doc manpages-dev
$ apt install clang llvm lldb libc++-dev libc++abi-dev
$
# VSCode, cpptools, clangd, CodeLLDB
$ apt install ./code_1.86.1-1707298119_amd64.deb
$ dpkg -i code_1.86.1-1707298119_amd64.deb
$ apt install -f # Install dependencies
$ /usr/bin/code
$
# https://clangd.llvm.org/installation
$ apt install clangd
$ apt install clangd-13
$ update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-13 100
$
# install multiple gcc compiler versions
$ apt install gcc-10 gcc-9
$
$ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90
$ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100
$ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90
$ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
$
# mode: auto, manual. priority matters in auto mode.
$ update-alternatives --config gcc
$ update-alternatives --config g++
$ gcc --version
$ g++ --version
$
# tree using find
$ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
$
# find large size directories or files (use -h in both commands)
$ du -h -d1 /home/* | sort -hr | head -5
$
$ timedatectl list-timezones
$ timedatectl set-timezone "Asia/Shanghai"
$ /usr/sbin/dpkg-reconfigure tzdata
$
# Console Font: VGA
$ /usr/sbin/dpkg-reconfigure console-setup
$
$ systemctl get-default
graphical.target
$
$ ls /lib/systemd/system/*.target | grep multi-user
/lib/systemd/system/multi-user.target
$
$ systemctl set-default multi-user.target # graphical.target
$ init 3 # 5
$
$ lsblk
$ fdisk /dev/sdb
$ mkfs.ext4 /dev/sdb1
$ mount /dev/sdb1 /mnt/data
$
$ vi /etc/fstab
/dev/sr0 /media/cdrom0
$
$ df -h
/dev/sr0 3.7G /media/cdrom0
$
# resize disk partition
$ apt install gparted
# Disks / Delete swap partition / Delete extended partition
# / resize: reserve 1.0 GB (same) free space for extended and swap
# / create extended partition / create swap partition
#
# page down to select and add zh_CN.UTF-8 locale
# keep the default locale (en_US.UTF-8)
$ dpkg-reconfigure locales
$
# chinese input method editor (ime)
$ apt install ibus-libpinyin
$
# re-login or restart to take effect
# Settings / Keyboard / Input Sources / + / Chinese /
# Chinese (Intelligent Pinyin) / Add
#
# disable suspend or hibernation
# automatic suspend - computer will suspend very soon because of inactivity
$ systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
$
# https://extensions.gnome.org/
# install browser extension ,
#
# Dash to Dock , by michel_g ,
# Logo Activities, by orbitcorrection ,
#
# apt install gnome-shell-extension-prefs ,
# /usr/bin/gnome-shell-extension-prefs ,
#
# Left Super
$ gsettings get org.gnome.mutter overlay-key
'Super_L'
$ gsettings set org.gnome.mutter overlay-key ''
$
# settings / keyboard shortcuts
View split on left : Super + Left arrow
View split on right: Super + Left arrow
Restore window : Super + Down arrow
Maximize window : Super + Up arrow
# gave up waiting for suspend / resume device
# a start job is running for dev-disk-by
# use UUID from blkid to correct wrong UUID in files
$ blkid
$ vi /etc/initramfs-tools/conf.d/resume
$ vi /etc/fstab
$
# /usr/sbin/update-initramfs: 142: mkinitramfs: not found
$ PATH=$PATH:/usr/sbin /usr/sbin/update-initramfs -u
update-initramfs: Generating /boot/initrd.img-5.10.0-20-amd64
$
# https://www.debian.org/releases/
Debian 12 (Bookworm), 2023-06, GCC 12.2;
Debian 11 (Bullseye), 2021-08, GCC 10.2;
Debian 10 (Buster), 2019-07, GCC 8.3;
Debian 9 (Stretch), 2017-06, GCC 6.3;
Debian 8 (Jessie), 2015-04, GCC 4.9;
#
# sudo: unable to resolve host debian: Name or service not known
# make the host names eg. `abc` match in the two files:
$ cat /etc/hostname
abc
$
$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 abc
$
# terminal console
# pseudo terminal: TTY,
# ASCII,
# switch: Ctrl-Alt-F1, .. , -F6,
# terminal emulator: xterm, gnome-terminal,
# UTF-8, CJK,
$ tty
$ w
$ who
$ tty -s && echo "In a TTY"
# $ dpkg-reconfigure locales
$
# Old Debian releases on CD/DVD ,
# https://cdimage.debian.org/mirror/cdimage/archive/ ,
#