EasyBCD: GRUB2 => type SysLinux or BSD (not!!
GRUB2), Linux => type SysLinux
CSA:
SDA1 |
WINDOWS |
|
PRI NTFS (70 GB) (C:) |
SDA2 |
GRUB |
|
PRI EXT3 (300–500 MB) |
SDA3 |
(logical) |
|
|
SDA4 |
(PCBSD64) |
/ |
PRI (50GB) ada0s4 |
SDA5 |
WINCHK |
|
LOG NTFS (70 GB) |
SDA6 |
UB32 |
/ |
LOG EXT3 (150 GB) |
SDA7 |
UB64 |
/ |
LOG EXT3 (50 GB) |
SDA8 |
CENTOS64 |
/ |
LOG EXT4 (50 GB) |
SDB1 |
(nx) |
|
SDB2 |
(logical) |
ada1s2 |
SDB3 |
(nx) |
|
SDB4 |
(nx) |
|
SDB5 |
WINSWAP |
LOG NTFS 20 GB (S:) |
SDB6 |
WINCHKSWAP |
LOG NTFS 20 GB |
SDB7 |
UB32SWAP |
LOG Linux-Swap 30 GB |
SDB8 |
UB64SWAP |
LOG Linux-Swap 30 GB |
SDB9 |
CENTOS64SWAP |
LOG Linux-Swap 30 GB |
SDB10 |
(PCBSD64AWAP) |
LOG 30 GB (ada1s10b) |
CSB:
SDA1 |
WINDOWS |
|
PRI NTFS (70 GB) (C:) |
SDA2 |
GRUB |
|
PRI EXT3 (300–500 MB) |
SDA3 |
(logical) |
|
|
SDA4 |
(PCBSD64) |
/ |
PRI (50GB) ada0s4 |
SDA5 |
WINCHK |
|
LOG NTFS (70 GB) |
SDA6 |
UB32 |
/ |
LOG EXT3 (50 GB) |
SDA7 |
UB64 |
/ |
LOG EXT3 (150 GB) |
SDA8 |
FE64 |
/ |
LOG EXT4 (50 GB) |
SDA9 |
CENTOS64 |
/ |
LOG EXT4 (50 GB) |
SDA10 |
W2008R2 |
|
NTFS (100
GB) |
SDB1 |
(nx) |
|
SDB2 |
(logical) |
ada1s2 |
SDB3 |
(nx) |
|
SDB4 |
(nx) |
|
SDB5 |
WINSWAP |
LOG NTFS 20 GB (S:) |
SDB6 |
WINCHKSWAP |
LOG NTFS 20 GB |
SDB7 |
UB32SWAP |
LOG Linux-Swap 30 GB |
SDB8 |
UB64SWAP |
LOG Linux-Swap 30 GB |
SDB9 |
FE64SWAP |
LOG Linux-Swap 30 GB |
SDB10 |
CENTOS64SWAP |
LOG Linux-Swap 30 GB |
SDB11 |
(PCBSD64SWAP) |
LOG 30 GB (ada1s11b) |
SDC1 |
(MSFT Reserved) |
|
128 MB |
SDC2 |
VIRT |
|
NTFS (300 GB) |
Clonezilla:
partclone
EasyBCD:
SysLinux, redo after install (copies boot block to BCD)
If
booting GRUB from Linux partition, use separate (BOOT, ROOT) partitions to
avoid "blocklist" problem;
however this is not needed if master "GRUB" partition is used and
GRUB loading is performed only from this partition,
whereas Linux partitions are actually used only for "grub.cfg" files
and kernel files; also chattr +i helps
but watch out for backup/restore.
http://www.gnu.org/software/grub/manual/grub.html
http://members.iinet.net/~herman546/p20/GRUB2%20Bash%20Commands.html
mke2fs -b 2048
-j -U `uuid` -L
label /dev/...
mount /dev/... /mnt
mkdir /mnt/boot
grub-install --force
--boot-directory=/mnt/boot
--target=i386-pc --recheck /dev/...
chattr +i /mnt/boot/grub/i386-pc/core.img
grub-mkconfig -o /mnt/boot/grub/grub.cfg (called by update-grub)
umount /mnt
Place
in GRUB2's grub.cfg instead of the regular menu section (keep video etc.
settings):
set timeout=-1
set default=0
echo prefix=$root
echo root=$prefix
insmod part_msdos
insmod ext2
insmod ntfs
insmod gzio
menuentry "UB32" {
search --no-floppy --set root --label UB32
set prefix=($root)/boot/grub
#configfile $prefix/grub.cfg
multiboot $prefix/i386-pc/core.img
}
menuentry "UB64" {
search --no-floppy --set root --label UB64
set prefix=($root)/boot/grub
#configfile $prefix/grub.cfg
multiboot $prefix/i386-pc/core.img
}
menuentry "FreeBSD64" {
search --no-floppy --set root
--label FBSD64
chainloader +1
}
menuentry "Windows" {
search --no-floppy --set root --label WINDOWS
chainloader +1
}
menuentry "This is GRUB2" {
search --no-floppy --set root --label GRUB2
set prefix=($root)/boot/grub
configfile $prefix/grub.cfg
}
May want to re-make EasyBCD entry.
Use SysLinux or BSD for EasyBCD entry, not
GRUB2 type.
/etc/default/grub
/etc/grub.d/*
cd /etc/grub.d
chmod a-x 30_os-prober
40_custom
#!/bin/sh -e
cat << EOF or exec tail -n +3 $0 (and no EOF at end)
menuentry "...." {
.....
}
....
EOF
make sector-by-sector backup of GRUB2
master partition
update-grub
Emergency boot options:
S => single
text (remove "quiet splash" or set splash=off)
vga=ask / normal / extended
Ctrl-Alt-F1 exits window manager
after login: sudo
start lightdm
startx
sudo /etc/init.d/lightdm start
Debug boot:
fbcon=scrollback:1024K
apt-get install linux-crashdump
crashkernel = … (see separate cheat
sheet)
/etc/default/grub (for update-grub):
# to use last saved entry
GRUB_DEFAULT="saved"
GRUB_SAVEDEFAULT="true"
# to use specific entry
GRUB_DEFAULT="Ubuntu"
GRUB_DEFAULT=0
# disable Xen override
XEN_OVERRIDE_GRUB_DEFAULT=0
When copying an image:
mkfs.ext3 -b 2048
-j -U `uuid` -L
label /dev/...
restore image
fsck.ext3 -n -C0
-f /dev/…
tune2fs -L label device
mount /dev/… /mnt
edit
/mnt/etc/fstab (UUIDs for root
and swap)
edit /mnt/etc/hosts
edit /mnt/boot/grub/grub.cfg (root UUID)
edit /mnt/etc/hostname
using live CD, perform grub-install:
It
is desirable to use grub-install from the hard drive, rather than live CD:
mkdir
/x
mount
LABEL=... /x
mount
-o bind /dev /x/dev
mount
-o bind /sys /x/sys
mount
-o bind /proc /x/proc
chroot /x
(if switched root, omit /mnt prefix below)
mv /mnt/boot /mnt/boot.0
mkdir /mnt/boot
grub-install --force
--boot-directory=/mnt/boot --target=i386-pc --recheck
/dev/...
chattr +i /mnt/boot/grub/i386-pc/core.img
cp /mnt/boot.0/grub/grub.cfg /mnt/boot/grub/grub.cfg
rm –rf /mnt/boot.0
umount /mnt
refresh cached
boot block in EasyBCD
service lightdm {stop, start, restart}
Ctrl-Alt-F1
apt-get update
apt-get upgrade
apt-get install procinfo
apt-get install gparted
apt-get install uuid
apt-get install dos2unix
apt-get install telnetd
apt-get install vsftpd
edit /etc/vsftpd.conf: local_enable=YES write_enable=YES
restart vsftpd
apt-get install
gcc gdb
sync
reboot
Ubuntu 12.10 classic desktop
Ctrl-Alt-F1 or Ctrl-Alt-T
apt-get install gnome-desktop-environment
apt-get install gnome-shell
apt-get install gnome-session-fallback
apt-get install gnome-panel
apt-get install compizconfig-settings-manager
compiz-plugins
apt-get install gnome-tweak-tool unity-tweak-tool
apt-get update
apt-get upgrade
sync
reboot
Log in as GNOME Fallback (Metacity)
ccsm
Window Management
Application Switcher = on
gnome-tweak-tool or (14.04 and on) unity-tweak-tool
=> adjust fonts
edit border width:
/usr/share/themes/Ambiance/metacity-1/metacity-theme-1.xml
enable Ctrl-Alt-Backspace:
System Settings -> Keyboard Layout -> Options -> Key sequence to kill
xserver
enable Ctrl-Alt-Del (also try Ctrl-Esc):
System -> Preferences -> Keyboard Shortcuts
Add: Task Manager, gnome-system-monitor
click "Disabled", then "Reassign"
apt-get install synaptic
apt-get install lubuntu-desktop
alien dplg-dev debhelper
build-essential
apt-get install kfind xfe krusader
/etc/init/lightdm.conf: “sleep 7” before “exec lightdm”
Edit /usr/local/etc/sudoers
add at the very end : sergey ALL=(ALL) NOPASSWD: ALL
Labels, swap, partitions
e2label device
[new-label]
tune2fs -L label -U `uuid' device
blkid
ls -l /dev/disk/...
lsblk --topology --fs --all
blockdev ...
hdparm -ig /dev/sd<x>
dmsetup info
ls [--tree]
table
targets
/etc/fstab
UUID=... LABEL=...
swapon -s
swapoff /dev/sdb8
mkswap -L UB64SWAP
-U .... /dev/sdb8
swapon /dev/sdb8
swaplabel [-L
...] [-U ...] /dev/sdb8
parted ; gparted ; fdisk -l ; sfdisk ; cfdisk; sgdisk
mount -o remount,rw
/dev/sda7 or mount -o
remount,rw /path
findfs LABEL=... or findfs UUID=....
findmnt [-l]
(shows mounts)
Sysinfo
uname -a
uname -r
sysctl -a
/proc/...
lscpu, lspci, lsusb, lsdev
PCI browser/commander: MindShare Arbor (https://www.mindshare.com/Software/Arbor)
lsof (lists open files)
fuser -m -v -a /mount-path (list files
open on a mount point)
lsmod (currently
loaded modules)
modprobe -l
(available modules)
insmod xxx
rmmod xxx
modinfo [-k kernel]
[modulename | filename]
service --status-all
systool
powertop
arp-scan ...
lsscsi
lsscsi -s
lsscsi -dg
lsscsi -c
lsscsi -Lvl
(not UB:)
kernelcfg
(not UB:) chkconfig --list
(not UB:)
/etc/rc.d/initd/xxxxx restart
Console
reset (reset
font and everything)
clear (clear
screen)
TERM=linux
Ctrl-L (redraw
screen)
Shift-PgUp
(scroll up)
Logs
dmesg
gnome-system-log
/var/log/...
Help
apropos
whatis
Misc
rsync -a src
dst
cp -r src
dst
who; w
top
free -hl
date; hwclock
df -h / ; du -h
mc; xwc; konqueror; nautilus
nano
kwrite; gxedit; nedit
strace <cmd> //
trace syscalls
ltrace <cmd> //
trace DSO calls
bootchart (bootchart.org)
tree
Remote copy
rsync -av host:/srcpath
dst
receiver: netcat
-l 4444 | tar
xvf -
sender: tar xvf - {dirs} |
netcat receiver-host 4444
File search
find /path -name
"*abc*"
locate filename
; updatedb
kfind
Wine
add-apt-repository ppa:ubuntu-wine/ppa
apt-get install wine1.5 (EULA: TAB/ENTER)
Alt-F2 winecfg
Alt-F2 regedit
wine c:\\Program\
Files\\Starbase\\CodeWright\\cw32.exe
Alt-SysRq (hold
Alt, press SysRq, press key) sysctl
kernel.sysrq=1
s = sync
u = remount all file systems as read-only
r = turn off keyboard raw mode
b = reboot immediately without sync-ing and unmounting
disks
t = dump a list of tasks
p = dump registers
m = dump memory
0-9 = set console log level
h = helps
k = kill all processes (incl. X) on current virtual
console, secure login
e = send TERM signal to all processes except init
l = send KILL signal to all processes except init
After installing DLLs
ldconfig (rebuild ld bindings and cache)
ldd x.so
(display list of dependencies)
Sensors
apt-get install lm-sensors
sensors-select (answer all
"yes")
service module-init-tools restart
sensors
man sensors.conf (also: /etc/sensors.conf)
xsensors
apt-get install ksensors
ksensors
apt-get sensors-applet
"Add to panel..."
Disk images:
dd
bs=512 if=/dev/zero of=xxx.img
count=2048
dd bs=1M if=/dev/zero of=xxx.img
count=2048
(can also create sparse file with
skip=2047 count=1
mount: losetup
[-r] [-f or
/dev/loopX] xxx.img
list: losetup -a
mkfs –t ext3
/dev/loop0
mount /dev/loop0 /mnt
umount /mnt
delete: losetup
-d /dev/loop0
Image CD/DVD to ISO:
brasero (GUI)
isoinfo -d
-i /dev/cdrom | grep size
dd if=/dev/cdrom of=xxx.iso
bs=<block size from isoinfo>
Installing (old) Fedora / CentOS
mke2fs
-t ext4 -j -L label
/dev/...
after install: change label, update grub, swapon, fstab
yum update
(CentOS only:) add EPEL repository (dl.fedoraproject.org/pub/epel)
rpm -Uvh
http://.../epel*
yum repolist
yum install yumex
yum install procinfo
yum install gparted
yum install uuid
yum install dos2unix
(Fedora only:) install Cinnamon and
re-login with session=Cinnamon
add shortcuts for Terminal and gnome-system-monitor
configure fonts
configure Terminal
yum install telnet telnet-server
chkconfig telnet on
(Fedora:) systemctl start xinitd.service
(Fedora:) systemctl enable
xinitd.service
(CentOS:) service xinitd
start
setsebool -P ftp_home_dir
on
(CentOS:) service vsftpd
start
Installing Fedora Server 22:
Fedora documentation: docs root, SysAdm
Guide (PDF)
To enable copy/paste in KVM:
Display VNC -> Type = Spice
Video = QXL
Clock offset = localtime (?)
reboot
run the installer
select partition for mount point /
and for the swap
hostnamectl set-hostname name
// export http_proxy=...
// export https_proxy=...
dnf groupinstall gnome
dnf groupinstall 'Gnome Desktop' // may not exist, then ...
dnf groupinstall 'Fedora Workstation' // ... install this one
// to verify the installation: try
startx
dnf upgrade
systemctl set-default graphical.target
(default is multi-user.target)
before
reboot: |
grub2-mkconfig -o
/boot/grub2/grub.cfg |
on UEFI: |
grub2-mkconfig -o
/boot/efi/EFI/redhat/grub.cfg |
sync; sync; sync!
GRUB2 troubleshooting: https://fedoraproject.org/wiki/GRUB_2
if grub boot fails, boot from CD
mkdir /x
mount LABEL=... /x
mount -o bind /dev /x/dev
mount -o bind /sys /x/sys
mount -o bind /proc /x/proc
chroot /x
grub2-mkconfig -o ...
reboot, login
when logging in, select "Gnome
classic"
system settings -> Details, change
host name
system settings -> keyboard, define
shortcut: C-A-T => gnome-terminal
dnf install -y procinfo gparted uuid
dos2unix
dnf install -y gcc gdb filezilla meld
xfe krusader
dnf install -y hdparm sysfsutils
powertop strace ltrace
systemctl enable sshd.service
systemctl start sshd.service
dnf install -y telnet-server
systemctl enable telnet.socket
systemctl start telnet.socket
dnf install -y vsftpd
review /etc/vsftpd/vsftpd.conf: local_enable=YES write_enable=YES
setsebool -P ftp_home_dir 1 # enable
home dir access
setsebool -P ftpd_full_access 1 # enable full ftp access
systemctl enable vsftpd.service
systemctl start vsftpd.service
dnf install -y system-config-firewall
system-config-firewall
OR:
systemctl stop firewalld.service
systemctl disable firewalld.service
dnf install -y gnome-tweak-tool
gnome-tweak-tool => select font
sizes
edit /etc/sudoers:
add at the very end : sergey ALL=(ALL) NOPASSWD: ALL
Optionally install Cinnamon desktop:
dnf install -y cinnamon
cinnamon-desktop
reboot
login with "Cinnamon" GUI
target
change terminal color profile
to add applications to the panel,
right-click on the application
cockpit: localhost:9090
systemctl show
status [xxx.service] // or pattern
list-units [xxx.service] // or pattern
list-unit-files [xxx.service]
// or pattern
list-sockets
enable/disable <xxx.service>
stop/start/restart <xxx.service>
Unit control files are located under
/usr/lib/systemd/...
dnf install -y system-config-nfs system-config-audit system-config-httpd system-config-users system-config-users-docs
dnf install -y
system-config-network
system-config-services
system-config-services-docs gnome-system-log
dnf install -y system-config-lvm // no longer in RHEL 7
system-config-nfs
audit
httpd
users
network
services
lvm // no longer in RHEL7
gnome-system-log // do not sudo! => also largely replaced by
journalctl
Installing openSUSE
if installing under KVM -> use UTC time setting for
KVM (?)
during install:
·
run custom
paritioner
·
select "Add
online repositories" (all)
·
select GNOME
control panel -> tweak tool -> tweak fonts
control panel -> keyboard -> create shortcut for
gnome-terminal
define network proxy:
sudo -E gedit /etc/sysconfig/proxy
systemctl start NetworkManager
systemctl enable NetworkManager
zypper repos --uri
zypper refresh
zypper update
sync; reboot
// zypper search <keyword>
// zypper info <pkg>
zypper install -y gnome-shell-classic
zypper install -y nano mlocate gparted telnet-server
vsftpd
zypper install -y gcc gcc-c++ make automake autoconf
git
zypper install -y sysfsutils powertop tree
zypper install -y krusader sensors meld filezilla
http://software.opensuse.org/package/xfe
http://software.opensuse.org/package/arp-scan
http://software.opensuse.org/package/ltrace
control panel -> YAST
or from command line: sudo -E yast2 &
set hostname
nano /etc/HOSTNAME
hostname <name>
or use YAST -> NetworkDevices / NetworkSettings
-> Hostname/DNS
systemctl start xinetd.service
systemctl enable xinetd.service
(or use YAST -> Services Manager)
YAST -> Network Services (xinetd)
enable telnet
enable/edit vnc1, vnc2, vnc3
optionally enable telnet port (23) in YAST ->
Firewall
edit /etc/vsftpd.conf:
local_enable=YES
write_enable=YES
if root ftp is needed, edit /etc/ftpusers and comment
out root
systemctl restart vsftpd.service
systemctl enable vsftpd.service
YAST -> Firewall -> enable vsftpd
grub2-mkconfig -o /boot/grub2/grub.cfg
Documentation:
SLES: https://www.suse.com/documentation/sles-12
openSUSE: https://activedoc.opensuse.org
systemctl: https://activedoc.opensuse.org/book/opensuse-reference/chapter-8-the-systemd-daemon
NVidia custom driver
disable custom startup-time compilers such as
/opt/hp/nvconfig
in /etc/modprobe.d/nvidia-graphics-drivers.conf or
/etc/modprobe.d/blacklist.conf:
blacklist nouveau
/etc/sysconfig/kernel
change NO_KMS_IN_INITRD = "yes"
make sure gcc --version matches gcc version to used
build kernel (/proc/version)
./NVIDIA-Linux-x86_64-331.20.run -K -k 3.12-(id)
mkinitrd
nvidia-settings
nvidia-xconfig
nomdeset
modeset.nouveau=0
S.M.A.R.T.
# Ubuntu
apt-get
install smartmontools gsmartcontrol
# Fedora
dnf install -y smartmontools gsmartcontrol
# openSUSE
zypper install -y smartmontools
http://software.opensuse.org/package/gsmartcontrol
smartctl -a /dev/sda
gsmartcontrol
auto tools (from configure.ac)
aclocal
autoconf
autoheader
automake –a
make
LVM
apt-get install lvm2
system-storage-manager #
Ubuntu
dnf -y install lvm2 system-storage-manager #
Fedora
Create:
fdisk /dev/sdb => n, p, 1, ... w, p, q
pvcreate /dev/sdb1
vgcreate -v vg1
/dev/sdb1 ...
# create /dev/vg1/lv1
lvcreate -v [-vv] --extents
100%FREE -n lv1
vg1
lgcreate -v [-vv] --size 10G -n
lv1 vg1
Destroy:
lvremove vg1/lv1
vgremove vg1
View/Info:
pvscan
pvdispaly
pvs
vgscan
vgdisplay
vgs
lvscan
lvdisplay
lvs
lvmdiskscan
/etc/lvm/lvm.conf
system-config-lvm
pvs --rows --separator ' ' -o pv_all
pvs --rows --separator ' ' -o seg_all
vgs --rows --separator ' ' -o vg_all
lvs --rows --separator ' ' -o lv_all
lvs --rows --separator ' ' -o pvseg_all
lvs -a -o name,devices
lvs -a -o +devices
lvs -a --segments -o +seg_pe_ranges
ssm list
dmsetup ls --tree
dmsetup info
dmsetup table
dmsetup deps
lvm dumpconfig
Add disk to vg
fisk /dev/sdc
vgextend vg1 /dev/sdc1
Convert logical volume to mirrored one
lvconvert -m 1 vg1/lv1
lvs -o name.copy_percent,devices
Snapshot
lvcreate --snapshot
--name snap1 vg1/lv1
ssm snapshot ...
Resize
lvextend --size 2G
vg1/lv1
lvreduce --size 2G vg1/lv1
ssm resize ...
SSM
ssm list
ssm resize ...
ssm snapshot ...
ssm remove...
ssm create ...
ssm remove ...
ssm add ...
NFS
http://www.tldp.org/HOWTO/NFS-HOWTO/server.html
http://www.tldp.org/HOWTO/NFS-HOWTO/client.html
http://www.tldp.org/HOWTO/NFS-HOWTO/performance.html
http://www.tldp.org/HOWTO/NFS-HOWTO/security.html
http://www.tldp.org/HOWTO/NFS-HOWTO/troubleshooting.html
http://www.tldp.org/HOWTO/NFS-HOWTO/interop.html
https://help.ubuntu.com/community/NFSv4Howto
http://www.citi.umich.edu/projects/nfsv4/linux/using-nfsv4.html
RHEL7
documentation (ch. 8)
NFS server
sudo apt-get install nfs-kernel-server
Ubuntu: update-rc.d nfs-kernel-server
SuSE/RH: checkconfig
nfs-kernel-server on
Fedora: systemctl
start/enable nfs-server.service nfs
rpcbind (replaces portmap)
service
nfs-kernel-server restart
optionally:
modprobe nfs
optionally:
service idmapd restart
optionally edit /etc/default/nfs-common
# if not YES mounts may be slow
NEED_GSSD=yes
edit /etc/hosts.deny
(see man 5 hosts_access):
portmap lockd mountd rquotad statd : ALL
(or use ALL EXCEPT LOCAL)
edit /etc/hosts.allow
portmap lockd mountd rquotad statd : 192.168.
(or LOCAL)
(or
.mydomain.com)
(or
192.168.21.0/255.255.255.0)
(or csa,csb)
edit /etc/exports (see man 5 exports):
path1 dest(opts) dest(opts) ...
path2 dest(opts) dest(opts) ...
path3 opts12 dest1 dest2 dest3(opts3)
for example:
/my1 csa(rw)
csb(ro)
/my2
csa(rw,no_root_squash) csb(ro,all_squash,anonuid=100,anongid=100)
/my3
proj*.local.domain(rw)
/my4
*.local.domain(ro) @trusted(rw)
/pub
*(ro,insecure,all_squash)
/my5 rw csx
@trusted @external(ro)
/my6
192.168.0.0/255.255.255.0(ro)
Ubuntu: service
nfs-kernel-server restart (required for /etc/hosts.* changes, also
reloads from /etc/exports)
Fedora: systemctl restat
nfs.servvice
and/or
exportfs -rav
(ok for /etc/exports)
this must start services
rpc.portmap
rpc.mountd
rpc.nfsd
rpc.statd
rpc.lockd (if necessary)
rpc.rquotad
Diagnostics:
rpcinfo -p
showmount --exports <host>
showmount --all
showmount --directories
nfswatch
Can also use "mount --bind" to give local
directories fixed names
mkdir /myexports
mkdir /myexports/aaa
mkdir /myexports/bbb
mount --bind /somepath1/xaaa /myexports/aaa
mount --bind /somepath2/xbbb /myexports/aaa
exportfs -ofsid=0,insecure,no_subtree_check
*:/myexports/aaa
exportfs -orw,nohide,insecure,no_subtree_check
*:/myexports/bbb
to make it permanent, edit /etc/fstab:
/somepath1/xaaa
/myexports/aaa none bind
0 0
/somepath2/xbbb
/myexports/bbb none bind
0 0
Fedora:
dnf install -y system-config-nfs
system-config-nfs
https://fedoraproject.org/wiki/Administration_Guide_Draft/NFS
NFS client
sudo apt-get install nfs-common
mkdir /mnt/nfs
mount -t nfs[4] myserver:/my2 /mnt/nfs
add to /etc/fstab:
# device mountpoint fs-type
options dump
fsckord
...
master.foo.com:/home /mnt/home
nfs
rw,hard,intr,nosuid,_netdev 0 0
...
or use automount
for some severs, incl. Fedora, explicitly request -o v3 (NFS3)
NFS client automount
https://help.ubuntu.com/community/Autofs
RHEL7
documentation (ch 8.4)
apt-get install autofs
Edit /etc/auto.master:
/aaa /etc/auto.aaa
--timeout 60
/bbb
/etc/auto.bbb --timeout 60
Edit /etc/auto.aaa:
zzzz -rw,soft,intr,rsize=8192,wsize=8192
myhost.mydomain.net:/mydata
/aaa must be empty
creates /aaa/zzzz and mounts on it
Ubuntu:
update-rc.d autofs
SuSE/RH: checkconfig autofs on
service autofs start
service autofs reload
IPTABLES:
iptables -L -v -n --line-numbers
iptables --flush
watch -d -n 2 iptables -nvL
http://ipset.netfilter.org/iptables.man.html
http://www.cyberciti.biz/tips/linux-iptables-examples.html
https://help.ubuntu.com/community/IptablesHowTo
https://www.frozentux.net/iptables-tutorial/iptables-tutorial.html
https://en.wikipedia.org/wiki/Iptables
AppArmor:
https://help.ubuntu.com/community/AppArmor
# disable apparmor
sudo invoke-rc.d apparmor kill [or stop]
sudo update-rc.d -f apparmor remove
# enable apparmor
sudo invoke-rc.d apparmor start
sudo update-rc.d apparmor start 37 S .
# reload all profiles
sudo invoke-rc.d apparmor reload
/etc/apparmor.d/...
/var/log/libvirt/...
/var/run/livirt/...
/var/lib/libvirt/...
Multi-homed Linux machines routing, simple:
·
Use NetworkManager
for secondary interfaces, specify:
o
address = manual
(static)
o
no gateway
o
DNS (optional)
o
use this
connection only for resources on this network = yes
·
for the primary,
specify:
o
address = manual
(static)
o
no gateway
o
DNS
·
execute
manually: ip route add default via 192.168.1.1
·
check everything
works
·
make default
gateway setting persistent:
https://wiki.gnome.org/Projects/NetworkManager/SystemSettings
create /etc/NetworkManager/dispatcher.d/10-route
#!/bin/bash
#echo "myroute: $1 $2" > /dev/kmsg
if [ "$1" == "eth2" ] && [
"$2" == "up" ]
then
ip route add
default via 192.168.1.1
fi
owner = root, no suid
chmod a+x 10-route
Multi-homed
Linux machines routing, more complex:
http://www.policyrouting.org/iproute2.doc.html
http://www.policyrouting.org/PolicyRoutingBook/ONLINE/TOC.html
http://www.slideshare.net/azilian/multi-homed-router
http://www.compendium.com.ar/policy-routing.txt
http://lartc.org/lartc.html
http://linux-ip.net/html/linux-ip.html
example: KVM machine connected to two libvirt routed
networks: 192.168.4.x and 192.168.5.x
VM-side
interfaces: 192.168.4.30, 192.168.5.30
host-side interfaces: 192.168.4.1,
192.168.5.1
make sure /proc/sys/net/ipv4/ip_forward is 1
add to /etc/iproute2/rt_tables
# numbers (24, 25) can be any
unused
24 rt4
25 rt5
execute:
ip route add 192.168.4.0/24
dev eth0 src 192.168.4.30 table rt4
ip route add default via
192.168.4.1 dev eth0 src 192.168.4.30 table rt4
ip rule add from 192.168.4.30
table rt4
ip rule add to 192.168.4.0/24
table rt4
ip route add 192.168.5.0/24
dev eth1 src 192.168.5.30 table rt5
ip route add default via
192.168.5.1 dev eth1 src 192.168.5.30 table rt5
ip rule add from 192.168.5.30
table rt5
ip rule add to 192.168.5.0/24
table rt5
# ip route flush cache
to verify:
ip route show table rt4
ip route show table rt5
ip rule
on external machines (or main router) add
# assuming vm host (or other
router) is 192.168.1.102
ip route add 192.168.4.0/24
via 192.168.1.102 [dev em0]
ip route add 192.168.5.0/24
via 192.168.1.102 [dev em0]
verify that both 192.168.4.30 and 192.168.5.30 can be
pinged and accessed
to persist in RHEL version of NetworkManager:
/etc/sysconfig/network-scripts/route-eth0
192.168.4.0/24 dev eth0 src
192.168.4.30 table rt4
default via 192.168.4.1 dev
eth0 src 192.168.4.30 table rt4
/etc/sysconfig/network-scripts/rule-eth0
from 192.168.4.30 table rt4
to 192.168.4.0/24 table rt4
/etc/sysconfig/network-scripts/route-eth1
192.168.5.0/24 dev eth1 src
192.168.5.30 table rt5
default via 192.168.5.1 dev
eth1 src 192.168.5.30 table rt5
/etc/sysconfig/network-scripts/rule-eth1
from 192.168.5.30 table rt5
to 192.168.5.0/24 table rt5
to persist in SUSE version of NetworkManager:
https://wiki.gnome.org/Projects/NetworkManager/SystemSettings
create /etc/NetworkManager/dispatcher.d/10-route
#!/bin/bash
#echo "myroute: $1
$2" > /dev/kmsg
if [ "$1" ==
"eth0" ] && [ "$2" == "up" ]
then
ip route add 192.168.4.0/24 dev eth0 src
192.168.4.30 table rt4
ip route add default via 192.168.4.1 dev
eth0 src 192.168.4.30 table rt4
ip rule add from 192.168.4.30 table rt4
ip rule add to 192.168.4.0/24 table rt4
fi
if [ "$1" ==
"eth0" ] && [ "$2" == "down" ]
then
ip route delete 192.168.4.0/24 dev eth0 src
192.168.4.30 table rt4
ip route delete default via 192.168.4.1 dev
eth0 src 192.168.4.30 table rt4
ip rule delete from 192.168.4.30 table rt4
ip rule delete to 192.168.4.0/24 table rt4
fi
if [ "$1" ==
"eth1" ] && [ "$2" == "up" ]
then
ip route add 192.168.5.0/24 dev eth1 src
192.168.5.30 table rt5
ip route add default via 192.168.5.1 dev eth1
src 192.168.5.30 table rt5
ip rule add from 192.168.5.30 table rt5
ip rule add to 192.168.5.0/24 table rt5
fi
if [ "$1" ==
"eth1" ] && [ "$2" == "down" ]
then
ip route delete 192.168.5.0/24 dev eth1 src
192.168.5.30 table rt5
ip route delete default via 192.168.5.1 dev
eth1 src 192.168.5.30 table rt5
ip rule delete from 192.168.5.30 table rt5
ip rule delete to 192.168.5.0/24 table rt5
fi
if [ "$1" == "eth2" ] && [ "$2" ==
"up" ]
then
ip route add default via 192.168.1.1
fi
owner = root, no suid
chmod a+x 10-route
FreeBSD
multi-homed routing (e.g. FreeNAS):
https://forums.freebsd.org/threads/reading-currently-running-kernel-configuration.2602
http://www.opennet.ru/base/net/bsd_pbr_route.txt.html
https://www.freebsd.org/cgi/man.cgi?query=ipfw%288%29
https://www.freebsd.org/doc/handbook/firewalls-ipfw.html
to check kernel options, sysctl kern.conftxt
Assuming dual-homed FreeNAS (or other FreeBSD system)
execute ipfw list
and check that rule number range used below (10-24) is available
execute:
ipfw 10 add skipto 25 ip from
192.168.4.10 to 192.168.4.10
ipfw 11 add fwd 192.168.4.1
ip from 192.168.4.10 to 192.168.4.0/24
ipfw 12 add fwd 192.168.4.1
ip from 192.168.4.10 to any
ipfw 13 add skipto 25 ip from
any to 192.168.4.10
ipfw 14 add fwd 192.168.4.1
ip from any to 192.168.4.0/24
ipfw 20 add skipto 25 ip from
192.168.5.10 to 192.168.5.10
ipfw 21 add fwd 192.168.5.1
ip from 192.168.5.10 to 192.168.5.0/24
ipfw 22 add fwd 192.168.5.1
ip from 192.168.5.10 to any
ipfw 23 add skipto 25 ip from
any to 192.168.5.10
ipfw 24 add fwd 192.168.5.1
ip from any to 192.168.5.0/24
to verify:
ipfw list
to abort:
ipfw flush
on external machines (or main router) add
# assuming vm host (or other
router) is 192.168.1.102
ip route add 192.168.4.0/24
via 192.168.1.102 [dev em0]
ip route add 192.168.5.0/24
via 192.168.1.102 [dev em0]
verify that both 192.168.4.10 and 192.168.5.10 can be
pinged and accessed
add
executed command as as init script
http://doc.freenas.org/9.3/freenas_tasks.html#init-shutdown-scripts
FreeNAS GUI: Tasks -> Init/Shutdown Scripts
Windows
multi-homed routing:
·
Assign
static addresses to interfaces
o
Do
not specify default gateway in adapter/interface definitions
·
Add
default route manually:
route -p add
0.0.0.0 mask 0.0.0.0 192.168.1.1 metric 500
or allow RIP to manage it
Kernel build
Tools
Ubuntu:
apt-get install kernel-package
libncurses5-dev fakeroot wget bzip2
apt-get install gtk+2.0 libglib2.0 libglade2.0
libglade2-dev qt4-dev-tools
apt-get install crash kdump-tools kexec-tools
(Ubuntu)
Fedora:
dnf install -y ncurses-devel
gtk2-devel glib2 libglade2 libglade2-devel
dnf install -y qt3-devel qt4-devel
libXi-devel gcc-c++
dnf install -y fedpkg fedora-packager
rpmdevtools
dnf install -y crash kexec-tools
openSUSE:
zypper install -y -t pattern
devel_kernel
zypper install -y gcc-c++ glib2
libglade-2_0-0 libglade2-devel
zypper install -y qt3-devel
libXi-devel
zypper install -y -t pattern devel_qt4
zypper install -y crash kexec-tools
Copy existing config file
/proc/config
/proc/config.gz
/boot/config-xxx
cd
/usr/src/linux-2.4.7-10
mv
.config .config.save
copy
….. .config
make oldconfig or
silentoldconfig (prompts user
about missing options)
Build
make clean (optional: deletes most generated
files, but leaves enough to build external modules)
make mrproper (delete the current
configuration and all generated files)
make xconfig or make gconfig (or:
make menuconfig or make config)
xconfig – X
windows based
gconfig – gtk+ based
menuconfig – ncurses based
config – text based, line by line
defconfig –
use defaults for target architecture
make sure BLK_DEV_INITRD = Y
to rename kernel, edit Makefile to change
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 7
EXTRAVERSION = -10custom (-0-my)
instead of EXTRAVERSION can use CONFIG_LOCALVERSION
make kernelrelease
make dep
nohup make -j8 bzImage
tail –f nohup.out
in parallel, in another terminal window:
nohup make -j8 modules
1>modules.out 2>modules.err
wait for completion and review logs:
less
nohup.out
less modules.out
less modules.err
If build was successful, install
make modules_install
cp arch/{i386 or x86_64}/boot/bzImage
/boot/vmlinuz-2.4.7-10custom
cp .config /boot/config-2.4.7-10custom
cp
System.map /boot/System.map-2.4.7-10custom
Ubuntu: mkinitramfs
-o (mkinitrd) /boot/initrd.img -2.4.7-10custom 2.4.7-10custom
Fedora/RHEL/SUSE: dracut --force
/boot/initramfs-2.4.7-10custom.img 2.4.7-10custom
note: dracut can complain about
"missing" modules that are actually built into the kernel
Update GRUB:
|
Building single module:
cp
Makefile Makefile.my
edit Makefile.m
#SUBDIRS =kernel drivers mm fs net ipc lib abi crypto
SUBDIRS =fs/autofs
make
–f Makefile.my modules
make –f
Makefile.my modules_install
Make documentation:
scripts/kernel-doc
-html kernel/rcu/tree.c >q1.html
scripts/kernel-doc -html include/linux/rcutiny.h >q2.html