Ubuntu Setup

From EWIKI
Jump to navigation Jump to search

Installation

Disk layout for Ubuntu 12.10:

Basic installation:

  • /
    • min. 6 GB
  • /var
    • min. 3 GB
  • swap
    • = RAM = 4 GB

GParted-AspireOne-128GB-SSD.png

Install:

  • sshd
  • Apache
  • PHP
  • wine
  • lame
  • mplayer

Fix Intel Problem

sudo apt-cache policy intel-microcode
sudo apt-get install intel-microcode=3.20180312.0~ubuntu18.04.1

Apache Reverse Proxy

Configure Static IP

vi /etc/network/interfaces

auto lo
iface lo inet loopback
# example
auto enp0s25
iface enp0s25 inet static
address 192.168.2.20
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameserver 8.8.8.8
dns-nameserver 8.8.4.4

Install Apache

sudo apt-get update --fix-missing
sudo apt-get upgrade
sudo apt install apache2 python-letsencrypt-apache

Enable reverse proxy

sudo a2enmod proxy
sudo a2enmod proxy_html
sudo a2enmod proxy_http 
service apache2 restart

Configure Reverse Proxies

vi /etc/apache2/mods-enabled/proxy_html.conf

ProxyRequests Off
ProxyPass /whb-gui/ http://192.168.2.11:8882/whb-gui/
ProxyPassReverse /whb-gui/ http://192.168.2.11:8882/whb-gui/
ProxyPass /whb/ http://192.168.2.11:8881/whb/
ProxyPassReverse /whb/ http://192.168.2.11:8881/whb/
ProxyPass /ewiki/ http://192.168.2.10/ewiki/
ProxyPassReverse /ewiki/ http://192.168.2.10/ewiki/
ProxyPass /lab/ http://192.168.2.50:8888/lab/
ProxyPassReverse /lab/ http://192.168.2.50:8888/lab/
ProxyPass /old/ http://192.168.2.10/
ProxyPassReverse /old/ http://192.168.2.10/
ProxyPass /server/ https:/192.168.2.10/server/
ProxyPassReverse /server/ https://192.168.2.10/server/
ProxyPass /jira/ https://192.168.2.10/jira/
ProxyPassReverse https://192.168.2.10/jira/ /jira/
ProxyPass /git/ https://192.168.2.11/git/
ProxyPassReverse /git/ https://192.168.2.11/git/
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

Apache HHTPS Certificate

Try:

Letsencrypt --apache -d mh.dyndns.me –d mh.dyndns.me

Deprecated:

wget https://dl.eff.org/certbot-auto
./certbot-auto --apache

Update LetsCrypt Certs

On Web proxy (192.168.2.20):

sudo su
./certbot-auto --apache

Important: Press c to cancle config changes after cert generation.

Copy certs to GitLab server

cd /etc/letsencrypt/live/mh.dyndns.me/
cp privkey.pem ~/mh.dyndns.me.key 
cp cert.pem ~/mh.dyndns.me.crt
cd
scp mh.dyndns.me.crt mh@192.168.2.11:/home/mh/mh.dyndns.me.crt
scp mh.dyndns.me.key mh@192.168.2.11:/home/mh/mh.dyndns.me.key

On GitLab (192.168.2.11):

cp mh.dyndns.me.* /etc/gitlab/ssl/
cp /etc/gitlab/ssl/mh.dyndns.me.* /etc/gitlab-runner/certs/
gitlab-ctl restart

Post Install Essential Packages

sudo apt-get update
sudo apt-get install gnome-panel gnome-flashback gnome-session-flashback indicator-applet-appmenu 
sudo apt-get install openjdk-7-jre-headless maven2
sudo apt-get install keepass2 gparted nfs-common dolphin thunar
sudo apt-get install mysql-server postgresql mysql-workbench  pgadmin3
sudo apt-get install subversion rapidsvn git filezilla curl
sudo apt-get install apache2 libabache2-mod-php
sudo apt-get install php-mysql php-gd php-json php-pgsql
sudo apt-get install gimp inkscape hugin rawtherapee
sudo apt-get install wine
sudo apt-get install rosegarden qsynth hydrogen audacity vlc streamtuner2 audacious lame mplayer2 streamripper
sudo apt-get install compizconfig-settings-manager compiz-plugins alacarte
sudo apt-get install binutils-avr avrdude avr-libc


others

sudo apt-get install ino
sudo apt-get install python-pip python-dev python-virtualenv

VS Code

https://code.visualstudio.com/Download

sudo dpkg -i codeXXX_amd64.deb
sudo apt-get install -f

Node.js

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs

Docker

sudo apt-get install apt-transport-https  ca-certificates curl  software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce

Asus ZenBook

https://gagor.pl/2016/04/tweaking-asus-zenbook-ux305ca-on-linux/

Gnome

Icons on Desktop

  1. Alt-F2 > dconf-editor
  2. org.gnome.desktop.background > show-desktop-icons=true

oder

  1. gnome-tweak-tool

Customize

https://askubuntu.com/questions/69576/how-to-customize-the-gnome-classic-panel

Scrolling

synclient VertEdgeScroll=1
synclient HorizEdgeScroll=1

Zyxel NSA310S

Web Admin

mount

mount -v -t nfs -o vers=2  -o nolock nsa310s:/i-data/9f4310dd/nfs/mh /mnt/netdrv/

evtl required:

apt install nfs-common

Radio Stations

Distributed Installation

The WSO2AM 1.3.1 docu is missing information about this.

Ref 1.3.0 docu about distributed installation: [1]

mySQL

Install

  • MySQL

Set up:

mysql -u debian-sys-maint -p 

(Password ist in /etc/mysql/debian.cnf)

MySql Shell:

update mysql.user set Password=password('MyNewPass') where User='root';
flush privileges;
grant all privileges on *.* to 'user'@'localhost' identified by 'newpassword' with grant option;
quit;

Load databases:

 mysql -u root -p < mysql-all.sql

Apache Cassandra

Edit package sources:

sudo vi /etc/apt/sources.list

Add

## Apache Cassandra
deb http://www.apache.org/dist/cassandra/debian 10x main
deb-src http://www.apache.org/dist/cassandra/debian 10x main
sudo apt-get update
gpg --keyserver wwwkeys.pgp.net --recv-keys 4BD736A82B5C1B00 
sudo apt-key add ~/.gnupg/pubring.gpg  
sudo apt-get update
sudo apt-get install cassandra

Edit port setting:

sudo vi /usr/share/cassandra/cassandra.in.sh

Change

-Dcom.sun.management.jmxremote.port=10036 \

ref: dZone Article

General

Change root password

sudo passwd

Disable guest account

pre v13

sudo gedit /etc/lightdm/lightdm.conf

v13.10

sudo gedit /etc/lightdm/lightdm.conf.d/50-unity-greeter.conf

add

allow-guest=false

Enable classic Gnome desktop

sudo apt-get install gnome-session-fallback 

then choose Unity or Gnome on login page.

Customize it unsing the gnome-tweak-tool

Fix Backlight Hotkey

sudo gedit /etc/default/grub

Add:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"
GRUB_CMDLINE_LINUX="acpi_osi=Linux"
sudo update-grub

not required since Ubuntu 14.10

NAS

sudo apt-get smbfs
sudo apt-get install smbfs
sudo apt-get install cifs-utils
sudo mkdir /mnt/nas
sudo mount -t cifs -o username=markus //192.168.2.120/markus /mnt/nas

Printer

sudo hp-setup -u

> manual 192.168.2.22


CUPS Config: http://localhost:631

Development Tools

GitLab CE

GitLab on Ubuntu

sudo apt-get install curl openssh-server ca-certificates postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
sudo gitlab-ctl reconfigure

Change external URL

Set the external_url [2] in /etc/gitlab/gitlab.rb:

external_url "https://example.com/gitlab"

Reconfigure GitLab:

sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

On Apache configure reverse proxy:

/etc/httpd/conf.d/proxy_git.conf

ProxyPass /git/ https://192.168.x.xx/git/
ProxyPassReverse /git/ https://192.168.x.xx/git/
SSLProxyEngine On
SSLProxyVerify none 
SSLProxyCheckPeerCN off
<Location /git>
  SSLRequireSSL
  RewriteCond     %{HTTPS}   Off
  RewriteRule     .*         https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</Location>

... and generate (or copy+rename pem) cert and key to

cd /etc/letsencrypt/live/mh.dyndns.me/
cp privkey.pem ~/mh.dyndns.me.key 
cp cert.pem ~/mh.dyndns.me.crt
cd
scp mh.dyndns.me.crt mh@192.168.2.11:/home/mh/mh.dyndns.me.crt
scp mh.dyndns.me.key mh@192.168.2.11:/home/mh/mh.dyndns.me.key

on 192.168.2.11 copy to

  • /etc/gitlab/ssl/mh.dyndns.me.key
  • /etc/gitlab/ssl/mh.dyndns.me.crt

Set logging of IPs via proxy [3]:

# Each address is added to the the NGINX config as 'set_real_ip_from <address>;'
nginx['real_ip_trusted_addresses'] = [ '192.168.2.10/24', '192.168.2.112', '2001:0db8::/32' ]
# other real_ip config options
nginx['real_ip_header'] = 'X-Real-IP'
nginx['real_ip_recursive'] = 'on'

CI-CD Pipelines

add local host to /etchosts and use certs

cp /etc/gitlab/ssl/mh.dyndns.me.* /etc/gitlab-runner/certs/

Backup/Restore

sudo gitlab-rake gitlab:backup:create
ls /var/opt/gitlab/backups/ -l

ref: https://docs.gitlab.com/ce/raketasks/backup_restore.html#creating-a-backup-of-the-gitlab-system

Update

sudo apt-get update
sudo apt-get install gitlab-ce 

ref: https://docs.gitlab.com/omnibus/update/README.html

Java

sudo apt-get install openjdk-7-jre-headless
sudo vi /etc/environment 

add:

JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386

Oracle Java

Eclipse

Install eclipse

Install the Eclipse Marketplace

  1. Open Eclipse, go to Help -> Install New Software...
  2. Select All Available Sites in the Work with dropdown menu.
  3. Wait for the list of software to populate; sometimes it takes a very long time.
  4. Expand the General Purpose Tools group, and tick Marketplace Client.
  5. Click Next, and again, accept the terms and conditions and click Finish.

This will install the marketplace. You will need to restart Eclipse for the change to take effect. Install m2e

  1. Open Eclipse, go to Help -> Eclipse Marketplace...
  2. Wait for it to finish loading.
  3. Enter "maven" in the search box and press return.
  4. Click the Install button next to Maven Integration for Eclipse by Eclipse.org (NB: there is a similar item above called "Maven Integration for Eclipse WTP" by Red Hat, Inc; this is not the correct one).

VisualStudio Code

Download and install.

Node.js

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs

Switch versions:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo n 6.9.4
sudo n 4.7.2
sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/node

To upgrade to latest version (and not current stable) version, you can use

sudo n latest

To undo:

sudo apt-get install --reinstall nodejs-legacy     # fix /usr/bin/node
sudo n rm 6.0.0     # replace number with version of Node that was installed
sudo npm uninstall -g n

SVN client

  • install
    • kdesv
    • SVN Repro htps://192.168.2.112/server/svn

Maven

  • Install maven

OpenLDAP

  • install OpenLDAP

ref Ubuntu OpenLDAP config

Music Software

  • Audacity
    • if plays too fast: add "tsched=0" parameter to udev initialization string in "/etc/pulse/default.pa" file.
  • Hydrogen
  • Qsynth
  • Rosegarden
  • VLC

Helpful scripts -- and really fast:

flv2mp3.sh

export sng=$(basename $1 .flv)
echo $1
mplayer $sng.flv -vo null -ao pcm:file=$sng.wav -srate 44100 -ni -novideo
lame -V2 $sng.wav $sng.mp3
rm $sng.wav

mp42mp3.sh

export sng=$(basename $1 .mp4)
echo $1
mplayer $sng.mp4 -vo null -ao pcm:file=$sng.wav -srate 44100 -ni -novideo
lame -V2 $sng.wav $sng.mp3
rm $sng.wav

Video Editing

ref also: http://www.techdrivein.com/2013/09/top-5-video-editors-for-ubuntu-linux.html

sudo add-apt-repository ppa:openshot.developers/ppa
sudo apt-get update
sudo apt-get install openshot openshot-doc

TerraTec Cinergy T USB XE

mh@AspireOne:~$ wget http://www.otit.fi/~crope/v4l-dvb/af9015/af9015_firmware_cutter/firmware_files/4.95.0/dvb-usb-af9015.fw 
mh@AspireOne:~$ sudo cp dvb-usb-af9015.fw  /lib/firmware/

Plug stick in...

mh@AspireOne:~$ lsusb 
Bus 002 Device 007: ID 0ccd:0069 TerraTec Electronic GmbH Cinergy T XE (Version 2, AF9015)
...
mh@AspireOne:~$ dmesg | grep -i dvb
[ 2605.381282] usb 2-1.2: dvb_usb_v2: found a 'TerraTec Cinergy T USB XE' in cold state
[ 2605.381375] usb 2-1.2: dvb_usb_v2: downloading firmware from file 'dvb-usb-af9015.fw'
[ 2605.449169] usb 2-1.2: dvb_usb_v2: found a 'TerraTec Cinergy T USB XE' in warm state
[ 2605.841867] usb 2-1.2: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[ 2605.841927] DVB: registering new adapter (TerraTec Cinergy T USB XE)
[ 2605.879627] usb 2-1.2: DVB: registering adapter 0 frontend 0 (Afatech AF9013)...
[ 2605.903119] usb 2-1.2: dvb_usb_v2: 'TerraTec Cinergy T USB XE' successfully initialized and connected

Enable users public HTML

mkdir ~/public_html
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/userdir.load
sudo ln -s ../mods-available/userdir.conf
sudo apache2ctl restart

Ref Ubuntu Help Page

SD card workaround

setpci -s 00:1c.2 0x50.B=0x40

AVR ISP mk2: Programmer Trick

I got my nice Atmel in-system-programmer, but unfortunately, the IDE on Linux couldn’t use it to burn code onto the MCU.

First install the uisp package:

sudo apt-get install uisp

The fix for this was to create a new file /etc/udev/rules.d/99-avrispmkii.rules with the following line:

BUS=="usb", ACTION=="add", SYSFS{product}=="AVRISP mkII", MODE="0666", SYMLINK+="avrdev"

Restart udev

sudo service udev restart

Re-plugging the ISP, the device node was world writable and the IDE could do its magic.

avrdude should work now:

avrdude -c avrisp2 -P usb -p m8 -U flash:w:avr-tst.hex

3D Printer

cura:

sudo add-apt-repository ppa:thopiekar/cura
sudo apt-get update
sudo apt-get install cura