Arch
Installation
timedatectl set-ntp true
cfdisk
/dev/sda1 -> /boot = 200M
/dev/sda2 -> swap = 2G
/dev/sda3 -> / = all
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda3
mkswap /dev/sda2
mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
vi /etc/pacman.d/mirrorlist
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
pacman -Syy
pacstrap /mnt base base-devel
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc --utc
cp /etc/locale.gen /etc/locale.gen.bak
vi /etc/locale.gen
(search and remove note)
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_TW.UTF-8 UTF-8
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
vi /etc/hostname
(input a hostname you want) {hostname}
cp /etc/hosts /etc/hosts.bak
vi /etc/hosts
(input)
127.0.1.1 {hostname}.localdomain {hostname}
systemctl enable dhcpcd
passwd
pacman -S intel-ucode os-prober grub
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
(if "warning failed to connect to lvmetad,falling back to device scanning.")
cp /etc/lvm/lvm.conf /etc/lvm/lvm.conf.bak
vi /etc/lvm/lvm.conf
(search and edit) use_lvmetad = 0
grub-mkconfig -o /boot/grub/grub.cfg
exit
reboot
useradd -m zy
passwd zy
chmod 640 /etc/sudoers
vim /etc/sudoers
zy ALL=(root) ALL
chmod 440 /etc/sudoers
pacman -S openssh
systemctl start sshd
systemctl enable sshd.service
cp /etc/systemd/timesyncd.conf /etc/systemd/timesyncd.conf.bak
sudo vim /etc/systemd/timesyncd.conf
(remove comments)
[Time]
NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 0.fr.pool.ntp.org
timedatectl set-ntp true
lnmp
sudo pacman -S nginx mariadb php-fpm
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo mysql_secure_installation
sudo systemctl start nginx
sudo systemctl start mariadb
sudo systemctl start php-fpm
nginx.conf:
location / {
root /usr/share/nginx/html;
index index.html index.htm index.php
}
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# virtual hosts
include ./vhosts-enabled/*;
base virtual host:
server {
listen 80;
server_name _;
root _;
index index.html index.htm index.php;
#access_log logs/host.access.log main;
location / {
try_files $uri $uri/ =404;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
VirtualBox
sudo pacman -S virtualbox-guest-utils virtualbox-guest-modules-arch
sudo modprobe -a vboxsf
sudo mkdir /mnt/cdhb
sudo mount -t vboxsf CodeHub /mnt/cdhb/
cp /etc/fstab /etc/fstab.bak
sudo vim /etc/fstab
(insert)
CodeHub /mnt/cdhb vboxsf defaults 0 0