Linux System Configuration: Difference between revisions
Jump to navigation
Jump to search
m Added MulticastDNS setting for systemd-resolved with avahi |
m Added Configurations for Void |
||
(18 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{| class="wikitable" style="width: 100%; text-align: center;" | {| class="wikitable" style="width: 100%; text-align: center;" | ||
! Description !! | ! Description !! Alpine !! Arch !! Debian !! Void | ||
|- | |- | ||
| Laptop Lid Switch Fix | | Laptop Lid Switch Fix | ||
| | | | ||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/elogind/logind.conf|2= | |||
<nowiki>... | |||
HandleLidSwitch=ignore | |||
...</nowiki>}} | |||
|} | |||
| colspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/systemd/logind.conf|2= | |||
<nowiki>... | |||
HandleLidSwitch=ignore | |||
...</nowiki>}} | |||
|} | |||
| | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/elogind/logind.conf|2= | |||
<nowiki>... | |||
HandleLidSwitch=ignore | |||
...</nowiki>}} | |||
|} | |||
|- | |- | ||
| Time Zone | | Time Zone | ||
| <code>ln -s /etc/zoneinfo/<Country>/<City> /etc/localtime</code> | | <code>ln -s /etc/zoneinfo/<Country>/<City> /etc/localtime</code> | ||
| colspan=3 | <code>ln -s /usr/share/zoneinfo/<Country>/<City> /etc/localtime</code> | |||
|- | |- | ||
| Locale Availability | | Locale Availability | ||
| <code>apk add musl-locales</code> | | <code>apk add musl-locales</code> | ||
| colspan=2 | <code>${EDITOR} /etc/locale.gen;</code><br /><code>locale-gen</code> | |||
|- | |- | ||
| Locale Selection | | Locale Selection | ||
| | | | ||
| | {| style="margin-left:auto;margin-right:auto;text-align:left;" | ||
| {{hc|/etc/profile.d/locale.sh|2= | |||
<nowiki>LANG=en_US.UTF-8 | |||
LANGUAGE=en_US | |||
LC_COLLATE=POSIX | |||
LC_MESSAGES=C | |||
LC_CTYPE=en_US.UTF-8 | |||
LC_NUMERIC=en_US.UTF-8 | |||
LC_TIME=en_US.UTF-8 | |||
LC_MONETARY=en_US.UTF-8 | |||
LC_PAPER=en_US.UTF-8 | |||
LC_NAME=en_US.UTF-8 | |||
LC_ADDRESS=en_US.UTF-8 | |||
LC_TELEPHONE=en_US.UTF-8 | |||
LC_MEASUREMENT=en_US.UTF-8 | |||
LC_IDENTIFICATION=en_US.UTF-8</nowiki>}} | |||
|} | |||
| colspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/locale.conf|2= | |||
<nowiki>LANG=en_US.UTF-8 | |||
LANGUAGE=en_US | |||
LC_COLLATE=POSIX | |||
LC_MESSAGES=C | |||
LC_CTYPE=en_US.UTF-8 | |||
LC_NUMERIC=en_US.UTF-8 | |||
LC_TIME=en_US.UTF-8 | |||
LC_MONETARY=en_US.UTF-8 | |||
LC_PAPER=en_US.UTF-8 | |||
LC_NAME=en_US.UTF-8 | |||
LC_ADDRESS=en_US.UTF-8 | |||
LC_TELEPHONE=en_US.UTF-8 | |||
LC_MEASUREMENT=en_US.UTF-8 | |||
LC_IDENTIFICATION=en_US.UTF-8</nowiki>}} | |||
|} | |||
|- | |- | ||
| Keymap | | Keymap | ||
| rowspan=2 | | | <code>setup-keymap</code> | ||
| | | rowspan=2 | | ||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/vconsole.conf|2= | |||
<nowiki>KEYMAP=us | |||
FONT=Lat2-Terminus16</nowiki>}} | |||
|} | |||
| <code>dpkg-reconfigure keyboard-configuration</code><br /><code>setupcon</code> | |||
| rowspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/rc.conf|2= | |||
<nowiki>... | |||
KEYMAP=us | |||
... | |||
FONT=Lat2-Terminus16 | |||
...</nowiki>}} | |||
|} | |||
|- | |- | ||
| Console Font | | Console Font | ||
| <code>${EDITOR} /etc/conf.d/consolefont;</code><br /><code>rc-update add consolefont boot</code> | | <code>${EDITOR} /etc/conf.d/consolefont;</code><br /><code>rc-update add consolefont boot</code> | ||
| <code>dpkg-reconfigure console-setup</code> | |||
|- | |- | ||
| Hostname | | Hostname | ||
| <code> | | colspan=4 |<code>echo "hostname" > /etc/hostname</code> | ||
|- | |- | ||
| Hosts | | Hosts | ||
| | | colspan=4 | | ||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/hosts|2= | |||
<nowiki># Static table lookup for hostnames. | |||
# See hosts(5) for details. | |||
127.0.0.1 localhost.local.lan localhost | |||
::1 localhost.local.lan localhost | |||
127.0.1.1 hostname.local.lan hostname</nowiki>}} | |||
|} | |||
|- | |- | ||
| Initramfs | | Initramfs | ||
| <code>${EDITOR} /etc/mkinitfs.conf; mkinitfs</code> | | <code>${EDITOR} /etc/mkinitfs.conf; mkinitfs</code> | ||
| | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/mkinitcpio.conf|2= | |||
<nowiki>... | |||
# Open-source drivers | |||
MODULES+=(amdgpu i915 nouveau radeon) | |||
# Proprietary NVIDIA | |||
MODULES+=(nvidia nvidia_drm nvidia_modeset nvidia_uvm) | |||
# QEMU virtual machines | |||
MODULES+=(bochs_drm cirrus qxl virtio-gpu) | |||
... | |||
HOOKS=(base udev autodetect) | |||
HOOKS+=(modconf block filesystems keyboard fsck) | |||
HOOKS+=(keymap consolefont) | |||
... | |||
# Only for filesystems already compressed with zstd | |||
COMPRESSION="cat" | |||
...</nowiki>}} | |||
<code>mkinitcpio -P</code> | |||
|} | |||
|- | |||
| User Creation | |||
| colspan=4 | <code>useradd -m -u <nnnn> -g users -G wheel,games,video,audio,optical,storage,scanner,power <username></code> | |||
|- | |||
| Passwords | |||
| colspan=4 | <code>passwd <username></code> | |||
|- | |||
| Package Manager | |||
| | |||
| | |||
{| style="margin-left:auto;margin-right:auto;" | |||
| | |||
{| style="text-align:left;" | |||
| {{hc|/etc/pacman.conf|2= | |||
<nowiki>... | |||
# If using ArchZFS, sometimes ArchZFS is behind Official Arch | |||
IgnorePkg = <kernel> <kernel>-headers zfs-<kernel> zfs-utils | |||
... | |||
# Misc options | |||
ILoveCandy | |||
#UseSyslog | |||
Color | |||
#NoProgressBar | |||
CheckSpace | |||
#VerbosePkgLists | |||
ParallelDownloads = 5 | |||
... | |||
[multilib] | |||
Include = /etc/pacman.d/mirrorlist | |||
... | |||
[archzfs] | |||
Include = /etc/pacman.d/archzfs-mirrorlist | |||
[zfs-<kernel>] # zfs-linux|zfs-linux-lts|zfs-linux-zen | |||
Server = http://kernels.archzfs.com/$repo/ | |||
[chaotic-aur] | |||
Include = /etc/pacman.d/chaotic-mirrorlist | |||
[andontie-aur] | |||
Server = https://aur.andontie.net/$arch</nowiki>}} | |||
{{hc|/etc/pacman.d/archzfs-mirrorlist|2=<nowiki> | |||
# France (origin) | |||
Server = http://archzfs.com/$repo/$arch | |||
# Germany/Duetschland | |||
Server = http://mirror.sum7.eu/archlinux/archzfs/$repo/$arch | |||
Server = https://mirror.biocrafting.net/archlinux/archzfs/$repo/$arch | |||
# India | |||
Server = https://mirror.in.themindsmaze.com/archzfs/$repo/$arch | |||
# United States | |||
Server = https://zxcvfdsa.com/archzfs/$repo/$arch</nowiki>}} | |||
{{bc|# ArchZFS | |||
pacman-key --recv-key DDF7DB817396A49B2A2723F7403BD972F75D9D76 | |||
pacman-key --lsign-key DDF7DB817396A49B2A2723F7403BD972F75D9D76}} | |||
{{bc|# Andontie AUR | |||
pacman-key --recv-key B545E9B7CD906FE3 | |||
pacman-key --lsign-key B545E9B7CD906FE3}} | |||
{{bc|# Chaotic AUR (only needed if chaotic-keyring is not installed) | |||
pacman-key --recv-key 3056513887B78AEB | |||
pacman-key --lsign-key 3056513887B78AEB}} | |||
|} | |||
|} | |||
| | |||
{| style="margin-left:auto;margin-right:auto;" | |||
| For Debian: | |||
{| style="text-align:left;" | |||
| {{hc|/etc/apt/sources.list|2= | |||
<nowiki>deb http://deb.debian.org/debian <release> main contrib nonfree | |||
deb http://deb.debian.org/debian <release>-updates main contrib nonfree | |||
deb http://deb.debian.org/debian <release>-security main contrib nonfree | |||
deb http://deb.debian.org/debian <release>-backports main contrib nonfree | |||
deb-src http://deb.debian.org/debian <release> main contrib nonfree | |||
deb-src http://deb.debian.org/debian <release>-updates main contrib nonfree | |||
deb-src http://deb.debian.org/debian <release>-security main contrib nonfree | |||
deb-src http://deb.debian.org/debian <release>-backports main contrib nonfree</nowiki>}} | |||
|} | |||
|} | |||
{| style="margin-left:auto;margin-right:auto;" | |||
| For Ubuntu: | |||
{| style="text-align:left;" | |||
| {{hc|/etc/apt/sources.list|2= | |||
<nowiki>deb http://archive.ubuntu.com/ubuntu/ <release> main restricted universe multiverse | |||
deb http://archive.ubuntu.com/ubuntu/ <release>-updates main restricted universe multiverse | |||
deb http://archive.ubuntu.com/ubuntu/ <release>-security main restricted universe multiverse | |||
deb http://archive.ubuntu.com/ubuntu/ <release>-backports main restricted universe multiverse | |||
deb http://archive.canonical.com/ubuntu <release> partner | |||
deb-src http://archive.ubuntu.com/ubuntu/ <release> main restricted universe multiverse | |||
deb-src http://archive.ubuntu.com/ubuntu/ <release>-updates main restricted universe multiverse | |||
deb-src http://archive.ubuntu.com/ubuntu/ <release>-security main restricted universe multiverse | |||
deb-src http://archive.ubuntu.com/ubuntu/ <release>-backports main restricted universe multiverse | |||
deb-src http://archive.canonical.com/ubuntu <release> partner</nowiki>}} | |||
|} | |||
|} | |||
To enable multilib on Debian-based distros:<br /> | |||
<code>dpkg --add-architecture i386</code> | |||
|- | |||
| NanoRC | |||
| colspan=4 | | |||
{| style="margin-left:auto;margin-right:auto;" | |||
| | |||
{| style="text-align:left;" | |||
| {{hc|/etc/nanorc|2= | |||
<nowiki>set boldtext | |||
set casesensitive | |||
set constantshow | |||
set locking | |||
set whitespace "»·" | |||
set titlecolor bold,lightwhite,blue | |||
set promptcolor lightwhite,lightblack | |||
set statuscolor bold,lightwhite,green | |||
set errorcolor bold,lightwhite,red | |||
set spotlightcolor black,lime | |||
set selectedcolor lightwhite,magenta | |||
set stripecolor ,yellow | |||
set scrollercolor cyan | |||
set numbercolor cyan | |||
set keycolor cyan | |||
set functioncolor green | |||
include /usr/share/nano/*.nanorc | |||
include /usr/share/nano-syntax-highlighting/*.nanorc</nowiki>}} | |||
| style="vertical-align:top" | | |||
{{hc|/root/.nanorc|2= | |||
<nowiki># nano < 5.0 (Ubuntu 20.04 = 4.8) | |||
set titlecolor brightwhite,magenta | |||
set statuscolor brightwhite,magenta | |||
set errorcolor brightwhite,red | |||
# 6.0 < nano >=5.0 (Debian 11 Bullseye = 5.2) | |||
# set titlecolor bold,lightwhite,magenta | |||
# set statuscolor bold,lightwhite,magenta | |||
# set errorcolor bold,lightwhite,red | |||
# set scrollercolor magenta | |||
# nano >=6.0 (Arch, Void) | |||
# set promptcolor black,yellow | |||
# set spotlightcolor black,orange | |||
# All of nano | |||
set selectedcolor brightwhite,cyan | |||
set stripecolor ,yellow | |||
set numbercolor magenta | |||
set keycolor brightmagenta | |||
set functioncolor magenta | |||
</nowiki>}} | |||
|} | |||
|} | |||
|- | |||
| sudo | |||
| colspan=4 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| | |||
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/0_privilege | |||
echo '%users ALL=(ALL) NOPASSWD:/usr/bin/dmidecode -t 17' > /etc/sudoers.d/dmidecode | |||
echo 'Defaults passprompt="[sudo] password for %U: "' > /etc/sudoers.d/prompt | |||
echo 'Defaults rootpw' > /etc/sudoers.d/rootpw | |||
|} | |||
|- | |||
| PolicyKit rootpw | |||
| colspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/polkit-1/rules.d/49-rootpw_global.rules|2= | |||
<nowiki>// Always authenticate Admins by prompting for the root password | |||
// similar to the rootpw option in sudo | |||
polkit.addAdminRule(function(action, subject) { | |||
return ["unix-user:root"]; | |||
});</nowiki>}} | |||
|} | |||
| | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/polkit-1/localauthority.conf.d/49-rootpw_global.rules|2= | |||
<nowiki>// Always authenticate Admins by prompting for the root password | |||
// similar to the rootpw option in sudo | |||
polkit.addAdminRule(function(action, subject) { | |||
return ["unix-user:root"]; | |||
});</nowiki>}} | |||
|} | |||
|- | |||
| Sticky bit directories | |||
| colspan=3 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/sysctl.d/stickybit.conf|2= | |||
<nowiki># Allow the creation regular files in world-writable sticky directories | |||
# when the file owner doesn't match that of the directory | |||
fs.protected_regular=0</nowiki>}} | |||
|} | |||
|- | |||
| NTP Client<br >([Open]NTP) | |||
| colspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/ntpd.conf|2= | |||
<nowiki>server [server1] | |||
server [server2] | |||
server [server3] | |||
restrict default kod limited nomodify nopeer noquery notrap | |||
restrict 127.0.0.1 | |||
restrict ::1 | |||
driftfile /var/lib/ntp/ntp.drift</nowiki>}} | |||
|} | |||
|- | |||
| NTP Client<br >(systemd-timesyncd) | |||
| | |||
| | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/systemd/timesyncd.conf|2= | |||
<nowiki>... | |||
[Time] | |||
NTP=[your-local-server] | |||
FallbackNTP=[closest-remote-server] | |||
...</nowiki>}} | |||
<code>timedatectl set-ntp true</code> | |||
|} | |||
|- | |||
| NTP Server | |||
| colspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/ntpd.conf|2= | |||
<nowiki>server [server1] | |||
server [server2] | |||
server [server3] | |||
server 127.127.1.0 | |||
fudge 127.127.1.0 stratum 10 | |||
restrict default kod nomodify notrap noquery | |||
restrict 192.168.10.0 mask 255.255.255.0 kod nomodify notrap | |||
restrict 127.0.0.1 | |||
restrict ::1 | |||
driftfile /var/lib/ntp/ntp.drift</nowiki>}} | |||
|} | |||
|- | |||
| Plymouth | |||
| | |||
| | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| <pre>cd /usr/share/plymouth | |||
cp arch-logo.png themes/spinner/watermark.png | |||
cd themes | |||
cp -r <theme> <theme>-custom | |||
cd <theme>-custom | |||
mv <theme>.plymouth <theme>-custom.plymouth</pre> | |||
|} | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/usr/share/plymouht/themes/<theme>-custom/<theme>.plymouth|2=<nowiki> | |||
... | |||
WatermarkHorizontalAlignment=.5 | |||
WatermarkVerticalAlignment=.6 | |||
...</nowiki>}} | |||
|} | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/plymouth/plymouth.conf|2=<nowiki> | |||
... | |||
Theme=<theme>-custom | |||
...</nowiki>}} | |||
|} | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/sysctl.d/20-quiet-printk.conf|2= | |||
<nowiki>kernel.printk = 3 3 3 3</nowiki>}} | |||
|} | |||
{{ic|setterm -cursor on >> /etc/issue}} | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/mkinitcpio.conf|2=<nowiki>... | |||
HOOKS=(...udev plymouth autodetect...) | |||
...</nowiki>}} | |||
<code>mkinitcpio -P</code> | |||
|} | |||
|- | |||
| SMARTd | |||
| colspan=3 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/smartd.conf|2= | |||
<nowiki>... | |||
DEVICESCAN -n standby,15,q -s (S/../.././02) | |||
...</nowiki>}} | |||
|} | |||
|- | |- | ||
| Limit Logs | | Limit Logs | ||
| | | | ||
| colspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/systemd/journald.conf|2= | |||
<nowiki>... | |||
SystemMaxUse=64M | |||
...</nowiki>}} | |||
|} | |||
|- | |||
| Reduced service timeout | |||
| | |||
| colspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/systemd/system.conf|2= | |||
<nowiki>... | |||
DefaultTimeoutStartSec=30s | |||
DefaultTimeoutStopSec=15s | |||
...</nowiki>}} | |||
|} | |||
|- | |||
| systemd-resolved<br />local host name resolution | |||
| | |||
| colspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/nsswitch.conf|2= | |||
<nowiki>... | |||
hosts: files mymachines myhostname resolve dns | |||
...</nowiki>}} | |||
|} | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/systemd/resolved.conf|2= | |||
<nowiki>... | |||
Domains=your.local.domain | |||
...</nowiki>}} | |||
|} | |||
|- | |- | ||
| systemd-resolved<br />with avahi | | systemd-resolved<br />with avahi | ||
| | | | ||
| colspan=2 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/systemd/resolved.conf|2= | |||
<nowiki>... | |||
MulticastDNS=no | |||
...</nowiki>}} | |||
|} | |||
|- | |||
| Default Editor | |||
| colspan=3 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/profile.d/editor.sh|2= | |||
<nowiki>export EDITOR=nano</nowiki>}} | |||
|} | |||
|- | |||
| Video Acceleration | |||
| colspan=3 | | |||
{| style="margin-left:auto;margin-right:auto;text-align:left;" | |||
| {{hc|/etc/profile.d/video-accel.sh|2= | |||
<nowiki>#!/usr/bin/env sh | |||
gmn() { | |||
lscpu | grep Model: | sed 's/\s\+//g' | cut -d: -f2 | |||
} | |||
case "$(lsmod)" in | |||
*amdgpu*) ldn=radeonsi; vdn=$ldn;; | |||
i915*) [ $(gmn) -gt 60 ] && ldn=iHD || ldn=i965; vdn=va_gl;; | |||
*nouveau*) ldn=nouveau; vdn=$ldn;; | |||
*nvidia*) ldn=vdpau; vdn=nvidia;; | |||
esac | |||
[ -n "$ldn" ] && export LIBVA_DRIVER_NAME=$ldn | |||
[ -n "$vdn" ] && export VDPAU_DRIVER=$vdn</nowiki>}} | |||
|} | |||
|} | |} |
Latest revision as of 21:42, 15 March 2022
Description | Alpine | Arch | Debian | Void | |||||
---|---|---|---|---|---|---|---|---|---|
Laptop Lid Switch Fix |
|
|
| ||||||
Time Zone | ln -s /etc/zoneinfo/<Country>/<City> /etc/localtime
|
ln -s /usr/share/zoneinfo/<Country>/<City> /etc/localtime
| |||||||
Locale Availability | apk add musl-locales
|
${EDITOR} /etc/locale.gen; locale-gen
| |||||||
Locale Selection |
|
| |||||||
Keymap | setup-keymap
|
|
dpkg-reconfigure keyboard-configuration setupcon
|
| |||||
Console Font | ${EDITOR} /etc/conf.d/consolefont; rc-update add consolefont boot
|
dpkg-reconfigure console-setup
| |||||||
Hostname | echo "hostname" > /etc/hostname
| ||||||||
Hosts |
| ||||||||
Initramfs | ${EDITOR} /etc/mkinitfs.conf; mkinitfs
|
| |||||||
User Creation | useradd -m -u <nnnn> -g users -G wheel,games,video,audio,optical,storage,scanner,power <username>
| ||||||||
Passwords | passwd <username>
| ||||||||
Package Manager |
|
To enable multilib on Debian-based distros: | |||||||
NanoRC |
| ||||||||
sudo |
| ||||||||
PolicyKit rootpw |
|
| |||||||
Sticky bit directories |
| ||||||||
NTP Client ([Open]NTP) |
| ||||||||
NTP Client (systemd-timesyncd) |
| ||||||||
NTP Server |
| ||||||||
Plymouth |
| ||||||||
SMARTd |
| ||||||||
Limit Logs |
| ||||||||
Reduced service timeout |
| ||||||||
systemd-resolved local host name resolution |
| ||||||||
systemd-resolved with avahi |
| ||||||||
Default Editor |
| ||||||||
Video Acceleration |
|