Home tmade.de

Home Wiki

apt-get

Examples:

sudo apt-get install ubuntu-desktop
sudo apt-get clean                                          #Clean "/var/cache/apt/archives" (programms installed with apt-get are saved in)
sudo apt-get install gdm
apt-get install --reinstall package
sudo /etc/init.d/gdm start
sudo dpkg-reconfigure xserver-xorg

sudo aptitude install kubuntu-desktop

apt-get install linux-image-3.2.0-24-generic linux-headers-3.2.0-24-generic

apt-get install build-essential                             #Compiler
apt-get install ntp ntpdate                                 #timeserver 
apt-get install libssl-dev
sudo apt-get install apache2 php5 php5-mysql mysql-server   #LAMP = Linux, Apache, MySQL, PHP
sudo apt install php libapache2-mod-php
apt-get install php5-mongo
apt-get install lvm2
apt-get install nfs-kernel-server 
apt-get install nfs-common  
sudo apt-get install phpmyadmin
apt-get install samba samba-common-bin smbclient cifs-utils
sudo apt-get install fwbuilder
apt-get install isc-dhcp-server
apt-get install isc-dhcp-relay
apt-get install nsca                                        #Passiv check monitoring client for nagios/ icinga
sudo aptitude install build-essential
apt-get install ia32-libs                                   #32-bit compatibility libraries
apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0          #32-bit compatibility libraries for Ubuntu Server 14.4 LTS
apt-get install libssl-dev                                  #openssl-devel
apt-get install lib32nss-mdns 
apt-get install openjdk-7-jdk
apt-get -s install awstats                                  #Option "-s" simulates an installation process  
apt-get install ocfs2-tools ocfs2console                    #Install ocfs2
dpkg-reconfigure ocfs2-tools                                #To configure ocfs2

apt-get install cifs-utils                    

apt-get install mailutils

apt-get install libncurses5-dev                             #Mysql
apt-get --only-upgrade install package_name                 #Only update the package "package_name" (run previously as always "apt-get update"!)
 
sudo update-rc.d -f gdm remove
sudo update-rc.d gdm stop 01 0 1 6 .
sudo reboot

sudo killall gdm                                            #kill the X-server

dpkg --list |grep postgres
dpkg --purge  postgresql-8.4 
rm -r /usr/share/postgresql/8.4/tsearch_data 
rm -r /etc/postgresql-common 
dpkg --purge  postgresql-client-common
dpkg --purge  postgresql-common 
aptitude autoclean
aptitude search mysql
aptitude clean postgresql-8.4
dpkg --list |grep postgres 
dpkg-reconfigure tzdata                                     #timezone set
dpkg-reconfigure locales                                    #system language
aptitude install postgresql
aptitude reinstall perl-base
hwe-support-status --verbose
ubuntu-support-status
systemctl stop apt-daily.timer
systemctl disable apt-daily.timer
apt-get install linux-generic-lts-xenial

apt-key

If there´s an error by executing “apt-get update” such as:

GPG error: http://repo.mysql.com trusty InRelease: The following signatures were invalid: KEYEXPIRED 1487236823 KEYEXPIRED 1487236823 KEYEXPIRED 1487236823

You can solve it by running

apt-key list | grep expired

Output:

pub   1024D/5072E1F5 2003-02-03 [expired: 2017-02-16]

To solve it run:

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 5072E1F5

and

apt-get update

again.

Update key:

apt-key adv --keyserver-options http-proxy=http://PROXYIP:8080 --keyserver hkp://keyserver.ubuntu.com:80 --recv <KEY>
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv

System update

To update all packages run:

apt-get update                          #Checks and downloads Packages
apt-get dist-upgrade                    #Updates System (all installed packages)

If you encounter problems if you are behind a proxy please enter into

/etc/apt/apt.conf

the following information

Acquire::http::Proxy "http://1.2.3.4:8080";

Git

Installation

The git version control system is installed with the following command:

apt-get install git

Basic usage

git init                                       #Initialize repository in actual working directory
git config --global user.name "Your Name"      #Set your account's default identity
git config user.name "Your Name"               #Set the identity only in this repository
git status                                     #Show which files tracked
git add file                                   #Add file "file"
git add .                                      #Add all files
git commit                                     #Commit all files
git log                                        #Show history
git reset --hard                               #Discard changes which are not commited yet
git revert ID                                  #Revert to change from ID - other changes after not affected
git checkout ID file                           #Revert to change from ID
git diff                                       #Show diff/ changes

Konfiguration

Every git user should first introduce himself to git, by running these two commands:

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

Basic usage

The above is already sufficient to use git in a distributed and secure way, provided users have access to the machine assuming the server role via SSH. On the server machine, creating a new repository can be done with:

git init --bare /path/to/repository

Note:This creates a bare repository, that cannot be used to edit files directly. If you would rather have a working copy of the contents of the repository on the server, ommit the –bare option.

Any client with SSH access to the machine can then clone the repository with:

git clone username@hostname:/path/to/repository

Once cloned to the client's machine, the client can edit files, then commit and share them with:

cd /path/to/repository
#(edit some files
git commit -a # Commit all changes to the local version of the repository
git push origin master # Push changes to the server's version of the repository

Security Update

If you just want to patch security packages:

grep security /etc/apt/sources.list > /tmp/security.list
apt-get upgrade -o Dir::Etc::Sourcelist=/tmp/security.list -s    #just a test
apt-get upgrade -o Dir::Etc::Sourcelist=/tmp/security.list       #patch security packages

Webmin

https://wiki.ubuntu.com/webmin

apt-get install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl apt-show-versions libapt-pkg-perl
apt-get update
apt-get install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl libmd5-perl apt-show-versions

Initrd

To update the initrd:

update-initramfs -c -k 3.2.0-23-generic        #Kernel-version 3.2.0-23-generic
update-initramfs -k all -c
update-grub

Init

service --status-all
initctl list

Grub Rescue

Check Version

lsb_release -a

UPGRADE VERSION/ Distribution

sudo do-release-upgrade 

Alternativ way:

Make backup of sources.list file:

cp /etc/apt/sources.list /etc/apt/sources.list.bku

and

cp -r /etc/apt/sources.list.d/ /etc/apt/sources.list.d.bak

Edit sources.list and add new repositary such as:

deb http://de.archive.ubuntu.com/ubuntu natty main restricted universe multiverse
#deb-src http://de.archive.ubuntu.com/ubuntu natty main restricted universe multiverse

deb http://de.archive.ubuntu.com/ubuntu natty-updates main restricted universe multiverse
#deb-src http://de.archive.ubuntu.com/ubuntu natty-updates main restricted universe multiverse

deb http://de.archive.ubuntu.com/ubuntu natty-security main restricted universe multiverse
#deb-src http://de.archive.ubuntu.com/ubuntu natty-security main restricted universe multiverse

Check also:

http://wiki.ubuntuusers.de/sources.list

Update sources:

apt-get update

Update distribution:

apt-get dist-upgrade

Unattended-upgrades:

To disable edit “/etc/apt/apt.conf.d/10periodic” as follows:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";

APTITUDE

aptitude search
aptitute install 

Install

sudo  tasksel    #Opens pattern install menu such as LAMP like during OS installation

Problems

To solve package problems for a particular package, delete related package-names in

/var/lib/dpkg/info/
/var/cache/apt/archives/

and run

apt-get -f install
apt-get update

Network

The following config (/etc/network/interfaces) shows a bonding interface (eth0, eth2) and a third networkdevice configuration (eth1):

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto bond0
iface bond0 inet static
        address 192.168.64.127
        netmask 255.255.255.0
        network 192.168.64.0
        broadcast 192.168.64.255
        gateway 192.168.64.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 192.168.63.4 192.168.63.8
        dns-search my-domain.local
        #slaves eth0 eth2
        #bond_mode 0
        #bond_miimon 100
        #bond_updelay 200
        #bond_downdelay 200
        post-up ifenslave bond0 eth0 eth2
        pre-down ifenslave -d bond0 eth0 eth2

#iSCSI Network Interface
auto eth1
iface eth1 inet static
        address 192.168.254.55
        netmask 255.255.255.0
        network 192.168.254.0
        broadcast 192.168.254.255
#        gateway 192.168.254.1
        # dns-* options are implemented by the resolvconf package, if installed

DHCP:

auto eth0
iface eth0 inet dhcp

Resolv.conf

sudo rm /etc/resolv.conf
sudo dpkg-reconfigure resolvconf 

HOSTNAME

1) edit /etc/hostname, to e.g. yourhost.dyndns.org

2) run : hostname -F /etc/hostname

3) edit /etc/hosts accordingly

Upstart

Upstart is a new way to start services. The old way (/etc/init.d) is still relevant, as upstart still uses (dependant on the service) init-scripts. Upstart scripts are located in

/etc/init

Upstart services are started via:

service servicename start/stop/restart

Links:

http://wiki.ubuntuusers.de/Upstart

Autostart Service

To check status of all services:

service --status-all
Running: + 
Not running: -
Status not known: ?

To add a service to autostart use:

/usr/lib/insserv/insserv -d servicename         #Add service "servicename" to autostart - a init-script is required!
/usr/lib/insserv/insserv -r servicename         #Remove service "servicename" from autostart

or

update-rc.d apache2 defaults                    #Add service apache to autostart with default runlevels
update-rc.d -f apache2 remove                   #Remove service apache from autostart

Ubuntu 16.04:

sudo systemctl stop mysql.service
sudo systemctl disable mysql.service

Proxy

To update your system via “apt-get” behind a http proxy, edit or create file

/etc/apt/apt.conf

and put following syntax inside:

Acquire::http::Proxy "http://PROXY_FQDN_or_IP:8080";

and if https is required

Acquire::https::Proxy "https://PROXY_FQDN_or_IP:8080";

To set a general system proxy:

export https_proxy=https://IP:Port
export http_proxy=https://IP:Port

Locale

locale -a                               #show available locale
cat /usr/share/i18n/SUPPORTED           #show supported locale
locale-gen de_DE.UTF-8                  #generate locale
update-locale LANG=de_DE.UTF-8          #update locale
locale                                  #check configure locale
cat /etc/default/locale                 #check configure locale

MISC

select-editor                                                  #set default editor

Force checking devices on next system startup:

touch /forcefsck 

Switch on “page up” and “page down” to search/ auto completition history (edit “/etc/inputrc”):

cat /etc/inputrc | grep search

Change

  
# alternate mappings for "page up" and "page down" to search the history
#"\e[5~": history-search-backward
#"\e[6~": history-search-forward

to

  
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
linux/ubuntu.txt · Last modified: 2017/12/19 15:58 by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki