NIX (unix OR”linux” OR”ubuntu” OR”kubuntu” OR”redhat” OR”debian” OR”centos” OR”fedora”)

NIX (unix OR”linux” OR”ubuntu” OR”kubuntu” OR”redhat” OR”debian” OR”centos” OR”fedora”)

2013-07-24. Category & Tags: Linux, Ubuntu

See also:

Install #

install ubuntu 2204 manually & turn off system updates (except security updates) #

image image

automaic / unattended installation of ubuntu #

  1. http://askubuntu.com/questions/122505/how-do-i-create-a-completely-unattended-install-of-ubuntu
  2. Completely-Automatic-Unattended-Install-of-Ubuntu-Auto-system-config-kickstart

multi systems selection #

multi-operating-system-installation

init after installation #

linux-init

ubuntu’s logical volume manager (lvm) #

[hard-drive, hard-disk, hdd, ssd]

context: #

Ubuntu OS (using LVM) has 3 mount points for 3 (physical or logical) partitions: efi, boot and /. image

The logical part / is layed as: image

In summary: Hard drives/partitions (hardware/metal) -> the Physical-Volumes (PVs, multiple) -> the Volume-Group (VG, only one) -> the Logical-Volumes (only 1 by default: /dev/ubuntu-vg/ubuntu-lv) - > the root File-System (i.e. /dev/mapper/ubuntu--vg-ubuntu--lv mounted on /).

situation 1: #

(It seems that,) by default, the LVM allocates only 100GB of Volume-Group’s available space to OS’s Logical-Volume (the value of “Allocated PE/Size”) and leave much alone (the value of “Free PE/Size”).
【as vgdisplay shows Volume-Group-display info】. image So the Logical-Volume can be extended by adding/allocating free space from “Free PE/Size” of Volume-Group: lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv which will take 100% “Free PE/Size” (verify by lvdisplay). Then we can resize the root File-System to use all space of the Logical-Volume: resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv (then verify by df -h).

situation 2: #

If there is free physical disk space available (such as a disk is newly added or the existing one is not fully occupied by the Logical-Group), we can see “Free Space” in cfdisk: image We can select the LVM’s Physical-Volume (usually the biggest) and “Resize” in cfdisk and then pvresize <device_name> in shell to take all (or only all-nearby?) free physical space into the Physical-Volume (verify by pvdisplay): pvresize /dev/sda3. Then we can repeat the steps in “situation 1” to have the new allocated space in use.

ref (bak) [resize ubuntu partitions, commands CLI, w/o gParted GUI]

Boot & Reboot #

  1. linux, ubuntu emergency safe reboot
  2. Boot to text console terminal mode [Ubuntu Kubuntu Nix Linux]
  3. GRUB rescue mode

Common Performance Improvement Tools #

Timezone #

rm /etc/localtime; ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime
reboot
see all available timezone: ls -R --group-directories-first /usr/share/zoneinfo or lg /usr/share/zoneinfo
ref

SELinux #

set right for apache/httpd: #

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-SELinux_Contexts_Labeling_Files.html

to disable selinux: #

http://www.thegeekstuff.com/2009/06/how-to-disable-selinux-redhat-fedora-debian-unix/

Configs #

Redhat 6:

  • Language: /etc/sysconfig/i18n to “zh_CN.UTF8”
  • TimeZone: /etc/sysconfig/clock to “China/Shanghai”

SElinux > Allow apache to use remote DB: #

setsebool -P httpd_can_network_connect_db=1

SELinux > Allow apache /php to send email: #

sudo setsebool -P httpd_can_sendmail 1## with the “-P” for persistent (across reboots).

Install RHEL EPEL Repo on Centos 6 #

OBS: when installing CentOS, it is suggested to install the “with updates” version.

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
sudo vim /etc/yum.repos.d/remi.repo
    enabled=1

ref

FAQ #

“You have new mail …”: apt install mailx “updatedb / locate: command not found”: apt install mlocate “dpkg 被中断,您必须手工运行 ‘sudo dpkg –configure -a’ 解决此问题”,但是如果执行 sudo dpkg –configure -a 指令,电脑会一直卡在 “updating database of manual pages” (man-db, manual db) 状态,系统卡死: sudo rm /var/lib/dpkg/updates/* && sudo apt-get update maybe also: && apt-get upgrade