-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfedora_install.txt
319 lines (254 loc) · 7.88 KB
/
fedora_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
# Fedora Linux install
# Disconnect network cable to speed up install in china
$ ls /sys/class/net
$ ip addr
$ ethtool enp0s3
# autoconnect=true
# method=auto
$ vi /etc/NetworkManager/system-connections/enp0s3.nmconnection
[connection]
id=enp0s3
type=ethernet
autoconnect=true
interface-name=enp0s3
[ipv4]
method=manual
address=192.168.1.100/24,192.168.1.1
dns=8.8.8.8;192.168.1.1;
$
$ systemctl restart NetworkManager
# BOOTPROTO=dhcp
$ vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
DEVICE=enp0s3
IPADDR=192.168.1.123
PREFIX=24
GATEWAY=192.168.1.1
DNS1=192.168.1.1
$
$ systemctl restart network
$ ip route
$ vi /etc/resolv.conf
nameserver 192.168.1.1
$
$ ping fedoraproject.org
# append user to wheel (sudo) group
$ su -c "/usr/sbin/usermod -a -G wheel `whoami`"
$ sg wheel
$ groups
wheel
$
# https://mirrormanager.fedoraproject.org/mirrors/Fedora/41/i386 ,
# https://mirrors.tuna.tsinghua.edu.cn/help/fedora/ ,
# https://mirror.nyist.edu.cn/help/fedora/ ,
# use baseurl, do not use metalink
$ vi /etc/yum.repos.d/fedora.repo
#baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/
baseurl=https://mirror.nyist.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/
#metalink=...
$
$ vi /etc/yum.repos.d/fedora-updates.repo
#baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/updates/$releasever/Everything/$basearch/
baseurl=https://mirror.nyist.edu.cn/fedora/updates/$releasever/Everything/$basearch/
#metalink=...
$
$ dnf makecache
$ dnf update
$ dnf upgrade
$ dnf list --installed
$ dnf list vim-enhanced
$ dnf search vim-enhanced
$ dnf install vim-enhanced # vim-minimal pre-installed
$ dnf repoquery --list vim-enhanced
$ dnf repoquery --file /usr/bin/vim
$ dnf repoquery --installed --list vim-enhanced
$ dnf repoquery --installed --file /usr/bin/vim
$ dnf provides "*/bin/vim"
vim-enhanced-2:9.1.393-1.fc40
$
$ dnf repoquery --file "*/bin/vim"
vim-enhanced-2:9.1.393-1.fc40.x86_64
$
$ vi ~/.vimrc
set hlsearch
set incsearch
set nocompatible " u always undo, Ctrl-r always redo,
set nowrapscan
"syntax off
$
$ vi ~/.inputrc
set editing-mode vi
$
$ 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.
ulimit -c unlimited # systemd-coredump
$
$ dnf install openssh-server
$ systemctl list-unit-files | grep sshd
$ systemctl enable sshd
$ systemctl start sshd
$ dnf install samba
$ systemctl enable smb nmb
$ systemctl start smb nmb
$ sudo smbpasswd -a `whoami`
$
$ smbpasswd -a `whoami`
$ vi /etc/samba/smb.conf
[homes]
read only = no
create mask = 0755
directory mask = 0755
$
$ firewall-cmd --permanent --add-service=samba
$ firewall-cmd --reload
$ getsebool -a | grep samba
$ setsebool -P samba_enable_home_dirs on
$ systemctl disable firewalld
$
$ vi /etc/selinux/config # restart to take effect
SELINUX=disabled
$
# resize lvm volume to use unallocated free space
$ df -h
/dev/mapper/fedora-root 15G 3.0G 12G 21% /
$
$ lsblk
sda 8:0 0 35G 0 disk
└─sda3 8:3 0 34G 0 part
└─fedora-root 253:0 0 15G 0 lvm /
$
$ pvresize /dev/sda3
$ lvextend -r -l +100%FREE /dev/mapper/fedora-root
# resize disk partition
$ dnf install gparted
$ fdisk /dev/sdb
$ mkfs.ext4 /dev/sdb1
$ mkdir /mnt/data
$ mount /dev/sdb1 /mnt/data
$ vi /etc/fstab
/dev/sdb1 /mnt/data ext4 defaults 0 0
$ mount /mnt/data/
$ vi /etc/hostname
$ hostname --file /etc/hostname
# find largest directories or files
$ du -h -d1 /home/* | sort -hr | head -5
# tree using find
$ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
$ timedatectl
$ timedatectl list-timezones
$ timedatectl set-timezone "Asia/Shanghai"
# GCC, GDB, C, C++
$ dnf group list "C Development Tools and Libraries"
c-development C Development Tools and Libraries no
$ dnf group list "Development Tools"
development-tools Development Tools no
$
$ dnf group info "C Development Tools and Libraries"
$ dnf group info "Development Tools"
$
$ dnf group install "c-development" # use group id, dnf 5,
$ dnf group install "development-tools" # use group id, dnf 5,
$
# $ dnf group install "Development Tools" # dnf 4,
# $ dnf group install "C Development Tools and Libraries" # dnf 4,
$ dnf install cmake
$ dnf install automake autoconf libtool
# VSCode, clangd, CodeLLDB
# https://code.visualstudio.com/docs/setup/linux#_rhel-fedora-and-centos-based-distributions
$ rpm --import https://packages.microsoft.com/keys/microsoft.asc
$ sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
$ dnf makecache
$ dnf upgrade
$ dnf install code
# clang-tools-extra (clangd)
$ dnf install clang-tools-extra
$ update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-13 99
$ update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-12 98
$ update-alternatives --config clangd
# install from vsix on vscode
$ wget https://github.com/vadimcn/codelldb/releases/download/v1.9.2/codelldb-x86_64-linux.vsix
$ dnf install llvm
$ dnf install lldb
$ dnf install clang
# address(leak), undefined behavior, thread sanitizer
$ dnf install libasan liblsan libubsan libtsan
$ dnf install systemd-udev # coredump, debian: systemd-coredump
$ coredumpctl debug # gdb: bt, backtrace
$ coredumpctl --output=~/foo.core dump
$ vi settings.json:
"clangd.fallbackFlags": [
"-std=c++2a",
"-I/usr/lib/gcc/x86_64-redhat-linux/13/include/sanitizer/lsan_interface.h", // fedora
"-I../foo",
],
$
#---
# enable clang-tidy static checks
clang-tidy is in package clang-tools-extra.
Clang-Tidy Checks list:
https://clang.llvm.org/extra/clang-tidy/checks/list.html ,
1. to enable clang-tidy static checks for c++ program in vscode,
just create a file .clang-tidy in the workspace root directory,
with the content:
C++ Core Guidelines: Appendix D: Supporting tools
These rules are named in the pattern cppcoreguidelines-* .
$ vi .clang-tidy
Checks: 'cppcoreguidelines-*'
$
on fedora linux, clang-tidy is provided by package clang-tools-extra,
$ dnf install clang-tools-extra
2. no compile_commands.json is needed.
3. do not try to enable clang-tidy static checks in vscode settings.json,
it will not work. create .clang-tidy in root directory is the correct way.
#---
# run level
$ ls /lib/systemd/system/*.target | grep multi-user
/lib/systemd/system/multi-user.target
$
$ systemctl set-default multi-user.target
Removed "/etc/systemd/system/default.target".
Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target.
$
$ systemctl get-default
multi-user.target
$
$ init 5 # or, 3
$ yum install centos-release-scl # software collections
$ yum install devtoolset-8
$ scl enable devtoolset-8 bash # for current session
$ vi ~/.bashrc
source scl_source enable devtoolset-8 # for all sessions
$
# turn off auto suspend and hibernation
$ 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
#
# dnf install gnome-shell
# /usr/bin/gnome-shell-extension-prefs
#
# Super (Command) on Left
$ gsettings get org.gnome.mutter overlay-key
'Super_L'
$ gsettings set org.gnome.mutter overlay-key ''
# Settings / Keyboard Shortcuts / Search for: "Super":
Maximize window : Super+Up,
Restore window : Super+Down,
View split on left : Super+Left,
View split on right: Super+Right,
#