Linux/Ubuntu

From Omnia
Jump to: navigation, search

Ubuntu

Ubuntu - Wikipedia

Download

14.04 LTS:

http://releases.ubuntu.com/14.04/

16.04 LTS:

http://releases.ubuntu.com/16.04/

Architectures

"The desktop version of Ubuntu currently supports the Intel x86 and the AMD64 architectures. Some server releases also support the SPARC architecture in addition to Intel x86 and AMD64. Unofficial support is available for the PowerPC, IA-64 (Itanium) and PlayStation 3 architectures." [1]

Releases

Source: Ubuntu - Wikipedia

Version Code name Release date
4.10 Warty Warthog 2004-10-20
5.04 Hoary Hedgehog 2005-04-08
5.10 Breezy Badger 2005-10-13
6.06 LTS Dapper Drake 2006-06-01
6.10 Edgy Eft 2006-10-26
7.04 Feisty Fawn 2007-04-19
7.10 Gutsy Gibbon 2007-10-18
8.04 LTS Hardy Heron 2008-04-24
8.10 Intrepid Ibex 2008-10-30
9.04 Jaunty Jackalope 2009-04-23
9.1 Karmic Koala 10/29/2009
10.04 LTS Lucid Lynx 4/29/2010
10.1 Maverick Meerkat 10/10/2010
11.04 Natty Narwhal 4/28/2011
11.1 Oneiric Ocelot 10/13/2011
12.04 LTS Precise Pangolin 4/26/2012
12.1 Quantal Quetzal 10/18/2012
13.04 Raring Ringtail 4/18/2013

apt

See apt

Disable SSH Banner

Xbu4L.png

For single user:

touch ~/.hushlogin

For all users, edit /etc/pam.d/sshd and comment out:

session    optional     pam_motd.so  motd=/run/motd.dynamic noupdate
session    optional     pam_motd.so # [1]

References:

Services

List services:

service --status-all
initctl list
initctl show-config

Status service:

service [service] status

Start service:

service [service] start

Stop service:

service [service] stop

Restart service:

service [service] restart

Remove service:

update-rc.d -f [service] remove

Add service:

update-rc.d [service] defaults

Current run level:

runlevel

Specify service priorities:

update-rc.d [service] defaults [START] [KILL]
update-rc.d apache2 defaults 90 90
update-rc.d mysql defaults 10 10
update-rc.d apache2 defaults 90  # 90 for both

Fully configure:

update-rc.d apache2 start 10 2 3 4 5 . stop 90 0 1 6 .

References:

Firewall

ufw

Enable firewall:

sudo ufw enable

Disable firewall:

sudo ufw disable

Show rules:

sudo ufw status
sudo ufw status numbered   # rule numbers
sudo ufw status verbose    # with port numbers

Allow traffic:

sudo ufw allow 53/tcp

Disallow traffic

sudo ufw deny 53/tcp

Delete rule:

sudo ufw delete allow 53/tcp
sudo ufw delete 1    # rules from 'status numbered'

Rules are written to:

 /lib/ufw/user.rules

References:

UFW Applications

/etc/ufw/applications.d/apache

[Apache]
title=Web Server
description=Apache v2 is the next generation of the omnipresent Apache web server.
ports=80/tcp

[Apache Secure]
title=Web Server (HTTPS)
description=Apache v2 is the next generation of the omnipresent Apache web server.
ports=443/tcp

[Apache Full]
title=Web Server (HTTP,HTTPS)
description=Apache v2 is the next generation of the omnipresent Apache web server.
ports=80,443/tcp

/etc/ufw/applications.d/terraria

[Terraria]
title=Terraria Server
description=Terraria Server
ports=7777/tcp

Make sure the application rule is not group writable:

chmod 644 [RULE_FILE]

List applications:

ufw app list

Application info:

ufw app info [APP]

Allow:

ufw allow Apache
ufw allow terraria

rsyslog

Not logging to /var/log/syslog

Check the file permissions

chown syslog /var/log/syslog *
service rsyslog restart

Run rsyslog in debug mode: [2]

rsyslogd -c3 -dn

Ubuntu apt sources

Tip: search google for "ubuntu sources.list generator" [3]

Primary repositories:

http://archive.ubuntu.com/ubuntu/dists/
http://security.ubuntu.com/ubuntu/dists/

Example 12.04 LTS (with sub repo branches, including universe) [4]

deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-security main restricted universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe

Example 12.04 LTS (with sub repo branches, including universe separated) [5]

deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted
deb http://us.archive.ubuntu.com/ubuntu/ precise-security main restricted
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted

deb http://us.archive.ubuntu.com/ubuntu/ precise universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-security universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe

Example 12.04 LTS default server install: (fio-benchmark vm)

deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse
# or without source repos
deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ precise universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse

Reference:

sources.list generator

Tip: search google for "ubuntu sources.list generator"

Ubuntu Sources List Generator - http://repogen.simplylinux.ch/

Repository Components

The repository components are:

  • Main - Officially supported software.
  • Restricted - Supported software that is not available under a completely free license.
  • Universe - Community maintained software, i.e. not officially supported software.
  • Multiverse - Software that is not free.

The Ubuntu Install CDs contain software from the "Main" and "Restricted" components of the repositories.

References:

Networking

Network configuration folder:

/etc/network/

Interfaces file:

/etc/network/interfaces

Local loopback address:

auto lo
iface lo inet loopback

DHCP Address: <re> auto eth0 iface eth0 inet dhcp </pre>

Static Address:

auto eth0
iface eth0 inet static
    address 192.168.1.5
    netmask 255.255.255.0
    gateway 192.168.1.254

Manually Configured Interface - not ifup (by external application)

auto eth0
iface eth0 inet manual

Note: The 'auto' line or lines indicates which interfaces should be brought up with 'ifup -a'. [6]

Another way to configure:

auto lo eth0 eth1

iface lo inet loopback

iface eth0 inet dhcp

iface eth1 inet static
    address 192.168.1.5
    netmask 255.255.255.0

References:

---

auto lo
iface lo inet loopback

iface eth0 inet dhcp
    hwaddress ether 36:f2:3b:e2:4f:2d
    auto eth0

Hostname

Change hostname

hostname [newhostname] ; hostname > /etc/hostname

Should also update /etc/hosts for consistency

---

Edit /etc/hostname

Run

sudo /etc/init.d/hostname.sh start
# or (depending on system)
service hostname start

PXE Install

Get netboot image from http://cdimage.ubuntu.com/netboot/

mkdir -p /tftpboot/pxe/images/ubuntu
cd /tftpboot/pxe/images/ubuntu
wget http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/netboot.tar.gz
tar -zvxf netboot.tar.gz
cp ubuntu-installer/amd64/linux .
cp ubuntu-installer/amd64/initrd.gz .

Tools:

  • system-config-kickstart - graphical tool for creating Kickstart files
apt-get install system-config-kickstart

References:

---

My kickstart:

install
text

#url --url http://uefi.int.fusionio.com/ubuntu/
url --url http://repo.int.fusionio.com/ubuntu/ubuntu

lang en_US
langsupport en_US
keyboard us
timezone America/Denver

#rootpw --disabled
rootpw password1
#user karl --fullname "karl" --iscrypted --password $1$tNU2BbnT$VX/2/60.GsgAoM6LEl8qs1
user fio --fullname "fio" --password password1
# asking about weak passwords for both root and fio

auth --useshadow --enablemd5
firewall --disabled

skipx

# bootloader --location=mbr
# zerombr yes
# clearpart --all --initlabel

reboot

%packages
openssh-server

%pre
echo "pre" > pre.txt

%post
echo "post" > post.txt

Sample kickstart: [7]

#Generated by Kickstart Configurator
#platform=x86

#System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone America/New_York
#Root password
rootpw --disabled
#Initial user
user karl --fullname "karl" --iscrypted --password $1$tNU2BbnT$VX/2/60.GsgAoM6LEl8qs1
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use CDROM installation media
cdrom
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#System authorization infomation
auth --useshadow --enablemd5
#Firewall configuration
firewall --disabled
#Do not configure the X Window System
skipx
#Package install information
%packages
@ ubuntu-desktop
ftp
openssh-server
bsdmainutils
emacs21-common
emacs21-bin-common
libungif4g
xaw3dg
emacs21
emacsen-common
liblockfile1
libapr0
chess
binutils
gcc-4.0

My Kickstart Generated by Kickstart Configurator

#Generated by Kickstart Configurator
#platform=AMD64 or Intel EM64T

#System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone --utc America/Denver
#Root password
rootpw password1
#Initial user
user fio --fullname "fio" --password password1
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation
url --url http://uefi.int.fusionio.com/uefi
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype ext3 --size 100
part swap --size 1024
part / --fstype ext4 --size 1 --grow
#System authorization infomation
auth  --useshadow  --enablemd5
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled
#Do not configure the X Window System
skipx
%pre --interpreter=python
test
%post --nochroot --interpreter=perl
test

Upstart

Start/Stop/Restart/Status service:

/etc/init.d/[service] [start|stop|restart|status]
service [service] start
service [service] stop
service [service] restart
service [service] status

List services:

ls /etc/init.d
service --status-all

Add/remove service:

update-rc.d [service] defaults
update-rc.d [service] remove
update-rc.d [service] start 20 2 3 4 5 .
update-rc.d [service] start 20 2 3 4 5 . stop 20 0 1 6 .
update-rc.d [service] stop 45 S .

References:

Driver Disk

Ubiquity/DriverUpdates - Ubuntu Wiki - https://wiki.ubuntu.com/Ubiquity/DriverUpdates

Partner Linux Driver Process - http://www.novell.com/developer/partner_linux_driver_process.html

Provide driver on removable media during installation? - Ask Ubuntu - http://askubuntu.com/questions/6499/provide-driver-on-removable-media-during-installation

"Alternatively, if you want a quick and dirty solution and assuming this is a disk driver, put the kernel module in one of the following directories:"

   /lib/modules/*/kernel/drivers/ide
   /lib/modules/*/kernel/drivers/scsi
   /lib/modules/*/kernel/drivers/block

Gnome Desktop

Install:

apt-get install x-window-system-core
apt-get install gnome
apt-get install xterm
reboot

Repair:

apt-get install --reinstall ubuntu-desktop

Ubuntu Desktop

Repair:

apt-get install --reinstall ubuntu-desktop

Auto Login

sudo mkdir /etc/lightdm/lightdm.conf.d
cat > /etc/lightdm/lightdm.conf.d/50-myconfig.conf << "EOF"
[SeatDefaults]
autologin-user=USERNAME
EOF

Ref: https://help.ubuntu.com/community/AutoLogin

OR

System Settings > User Accounts

xCOz0.png

Release Upgrade

Major release upgrade: (eg. Karmic Koala to Lucid Lynx)

sudo do-release-upgrade

I used this to successfully upgrade a Karmic Koala (9.10) to Lucid Lynx (10.04 LTS). And then from Lucid Lynx (10.04 LTS) to Precise Pangolin (12.04 LTS).

References:

Samba

Samba and CIFS:

sudo apt-get install cifs-utils
# older system:
sudo apt-get install smbfs

Mount:

mount //fileserver.oeey.com/share /mnt -t cifs -o user=guest

Remote Desktop Sharing

VNC

#apt-get install tightvncserver
#apt-get install xterm
#apt-get install xfce4
#apt-get install xfonts-base
apt-get install tightvncserver xterm xfce4 xfonts-base
vncserver
~/.vnc/xstartup:
  startxfce4 &
  xterm &

Kill:

killall Xtightvnc

Vino

Type “Desktop Sharing” into the dash and hit the configuration screen.

To disabled the encryption:

sudo apt-get install vino dconf-editor

As the regular login user (NOT ROOT!):

gsettings set org.gnome.Vino require-encryption false
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino authentication-methods "['none']"

Or Access via gui:

$ dconf-editor
org.gnome.desktop.remote-access

To auto start Vino on systems it doesn't auto start on (eg. Raspberry Pi)

## sudo su -
## cat > /etc/sudoers.d/vsrv.sh << "EOF"
## #!/bin/bash
## /usr/lib/vino/vino-server
## EOF
## chmod +x /etc/sudoers.d/vsrv.sh
## 
## cat >> /etc/xdg/lxsession/LXDE/autostart << "EOF"
## @/etc/sudoers.d/vsrv.sh
## EOF

sudo su -
cat > /etc/xdg/autostart/vino-server.desktop << "EOF"
[Desktop Entry]
Name=Desktop Sharing
Comment=GNOME Desktop Sharing Server
Exec=/usr/lib/vino/vino-server
Terminal=false
Type=Application
X-GNOME-Autostart-Phase=Applications
X-GNOME-AutoRestart=true
NoDisplay=true
EOF

Manually run:

pkill vino
export DISPLAY=:0.0
/usr/lib/vino/vino-server &


References:

DHCP Hostname

DHCP Register Hostname

Getting Debian to send your DHCP server it's hostname for Dynamic DNS - http://jeffwelling.github.io/2010/01/02/Debian-dynamic-dns.html

Should already be enbaled by default:

/etc/dhcp3/dhclient.conf
  send host-name = gethostname();

test with:

nslookup [hostname]

Issues

Slow NFS Mount

Ubuntu 14.04 NFS4 client has slow access to NFS - share

Syslog shows:

RPC: AUTH_GSS upcall timed out.
Please check user daemon is running.

/etc/modprobe.d/savenfs.conf

# ken
blacklist rpcsec_gss_krb5

unload module:

modprobe -r rpcsec_gss_krb5

And remount, should be instant.

References:

keywords