Ubuntu settings

I don’t pretend to publish anything new or fundamental here. I have only started working with Linux, so this post is just my way of keeping notes, in order not to search the web again. If it turns out to be useful for somebody else, I will only be glad. These settings were made for Ubuntu 18.04 LTS.

Here’s the previous version for Ubuntu 16.04 LTS: Ubuntu16_settings.txt


========================= Repair and update installation packages =========================

sudo apt-get clean
sudo apt-get update
sudo apt-get install -f
sudo dpkg -a --configure
sudo apt-get dist-upgrade
sudo apt-get upgrade


#========================== Make Linux use 'Local' time ==========================
timedatectl set-local-rtc 1

#================ Set the grub timeout and the grub default boot entry ===========

sudo gedit /etc/default/grub
sudo update-grub


====================================== Mount NTFS partition in fstab =======================

sudo mkdir /media/d1
sudo mkdir /media/d2
sudo blkid
sudo gedit /etc/fstab
UUID=7020AE1B20ADE874 /media/d1 ntfs-3g permissions,windows_names,locale=en_US.utf8 0 0
UUID=00C0C2ECC0C2E6CE /media/d2 ntfs-3g permissions,windows_names,locale=en_US.utf8 0 0
UUID=cb7a3f97-7393-4de1-8300-891db25e25f0 /media/dbox ext4 defaults 0 0

sudo mount -a

======================== replace swapfile with swap partition (smaller partition images) ==================

replace:
/swapfile none swap sw 0 0

with
UUID=1185b49e-0551-42c5-8510-3149f2964b8a swap swap defaults, noatime 0 2




#=================== Simple GUI adjustments ==========================
- Desktop backround solid color
- remove unneccessary icons from the launcher
- keyboard repeat delay: Settings > Universal Access > Typing > Repeat keys -- Speed setting works in inverse
- Nautilus Bookmarks: gedit ~/.config/gtk-3/bookmarks
- Language Support + Regional Formats
- Text Entry Settings
- Link colors in LibreOffice Calc: Tools > Options > LibreOffice > Application Colors
- Shortcuts on desktop
- Time & Date settings -- 24 H
- setup Thunderbird: Startup Applications
- login to Firefox

============== Minimize Thunderbird on close ==============

https://addons.mozilla.org/en-US/thunderbird/addon/keep-in-taskbar/?src=api

=====================================================


========================== Install Pulse Secure Client ===================

cd ~/Downloads
wget http://trial.pulsesecure.net/clients/ps-pulse-linux-5.3r3.0-b1021-ubuntu-debian-64-bit-installer.deb
sudo dpkg -i ~/Downloads/ps-pulse-linux-5.3r3.0-b1021-ubuntu-debian-64-bit-installer.deb

sudo apt-get install libc6
sudo apt-get install libwebkitgtk-1.0-0 
sudo apt-get install libproxy1 
sudo apt-get install libproxy1-plugin-gsettings 
sudo apt-get install libproxy1-plugin-webkit 
sudo apt-get install libdconf1 
sudo apt-get install libgnome-keyring0 
sudo apt-get install dconf-gsettings-backend


============ Disable Pidgin notifications ===============

Ctrl-U -- Libnotify Popups -- Configure plugin

========================== Install Virtualbox 5.2.18 ===================

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list.d/virtualbox.list'
sudo apt update
sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms
sudo apt update
sudo apt-get install virtualbox-5.2
sudo usermod -G vboxusers -a $USER
cd ~/Downloads
wget https://download.virtualbox.org/virtualbox/5.2.18/Oracle_VM_VirtualBox_Extension_Pack-5.2.18.vbox-extpack
virtualbox Oracle_VM_VirtualBox_Extension_Pack-5.2.18.vbox-extpack
rm cd ~/Downloads/virtualbox Oracle_VM_VirtualBox_Extension_Pack-5.2.18.vbox-extpack

Then logout


In BIOS chage secure boot settings from “Windows UEFI” to “Other OS” and execute:
modprobe vboxdrv




============ Laptop goes to sleep with lid closed before login and after logout ===============
sudo gedit /etc/systemd/logind.conf

Search for these lines and make them look like this (possibly by removing # in front or replacing suspend with ignore):

HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore



#============================= Disable password prompt in sudo (convenient but not secure -- do not forget to change it back!) ==============================
#1.
sudo visudo

#Change:
%sudo ALL=(ALL:ALL) ALL
#to
%sudo ALL=(ALL) NOPASSWD:ALL

#2.
sudo nano /etc/polkit-1/localauthority/50-local.d/99-nopassword.pkla

[No password prompt]
Identity=unix-group:sudo
Action=*
ResultActive=yes



#==================== Install Notepadqq ==================

Ubuntu Software OR:

sudo add-apt-repository ppa:notepadqq-team/notepadqq
sudo apt-get update
sudo apt-get install notepadqq


#=================== Disable Gnome animation =========================

0. Install Gnome Tweak Tool using Ubuntu Software

1. Appearance > Animations = Off


======================== ctrl+shift to change language =======================

open GNOME Tweaks (gnome-tweaks).
Select Keyboard & Mouse tab
Click Additional Layout Options button
Expand Switching to another layout
Select Ctrl + Shift here


=========================================== User groups ==================================
sudo addgroup GROUP

sudo adduser USERNAME GROUP

groups USERNAME


================================= Share folder for Windows ===============================
sudo apt-get install samba

sudo useradd user2
sudo smbpasswd -a user2

sudo gedit /etc/hostname

sudo gedit /etc/samba/smb.conf
[global]
usershare owner only = false

workgroup = ATE

and add to the end of the file:
[d1]
path = /media/d1
available = yes
valid users = user1
read only = no
browsable = yes
public = yes
writable = yes

[d2]
path = /media/d2
available = yes
valid users = user1
read only = no
browsable = yes
public = yes
writable = yes

[User2]
path = /media/d1/User2
available = yes
valid users = user2
read only = no
browsable = yes
public = yes
writable = yes

[Pics]
path = /media/d1/Pics
available = yes
valid users = user2
read only = no
browsable = yes
public = yes
writable = yes



path = /media/d2/video
available = yes
valid users = user2
read only = no
browsable = yes
public = yes
writable = yes


sudo gedit /etc/security/limits.conf
add to the end:
* - nofile 16384
root - nofile 16384

sudo service smbd restart

================================ Mount Windows Share =======================

https://ubuntuforums.org/showthread.php?t=2078120

sudo apt-get install cifs-utils

sudo mkdir /media/user1/user1-pc-d
sudo mkdir /media/user1/user1-pc-e

sudo gedit ~/.smbcredentials
username=msusername
password=mspassword

sudo chmod 600 ~/.smbcredentials

sudo gedit /etc/fstab

//user1-pc/d /media/user1/user1-pc-d cifs credentials=/home/user1/.smbcredentials,iocharset=utf8,sec=ntlm 0 0
//user1-pc/e /media/user1/user1-pc-e cifs credentials=/home/user1/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

sudo mount -a


=================== Install Skype =================================================
1. Install from Ubuntu software

2. In Tools > Settings: Uncheck "Automatically start Skype" and "Launch Skype in the background"

3. In Startup Apllications add "/snap/bin/skype %U"


=================== Install Viber =================================================

cd ~/Downloads
wget -O ~/Downloads/viber.deb http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb
dpkg-deb -x viber.deb viber
dpkg-deb --control viber.deb viber/DEBIAN
 Edit viber/DEBIAN/control and repace "libcurl3" with "libcurl4"
dpkg -b viber vibernew.deb
sudo dpkg -i vibernew.deb
rm viber.deb
rm vibernew.deb
rm -rf viber

Then add to Startup Applications: /opt/viber/Viber %u


================ Install 7zip and rar ===========================================
sudo apt-get update
sudo apt-get install rar unrar
sudo apt-get install p7zip-rar p7zip-full



================ Start Chrome with a certain profile ================

google-chrome --profile-directory=Default
google-chrome --profile-directory="Profile 1"


========================== Install Canon Lide 120 scanner driver ==========================

sudo add-apt-repository ppa:rolfbensch/sane-git
sudo apt-get install simple-scan sane-utils libsane libsane-common libsane-extras
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get -f install


sudo gedit /lib/udev/rules.d/40-libsane.rules

Add to the end:
# Canon CanoScan Lide 120
ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="190e", ENV{libsane_matched}="yes"

Save, reboot, and run:
sudo sane-find-scanner -v -v

========================== Install Canon LBP printer driver ==========================

http://help.ubuntu.ru/wiki/canon_capt


========================== Install Java JRE or JDK ==========================

sudo apt-get install default-jre
sudo apt-get install default-jdk

========================== Java enabled browser ==========================

palemoon





=================== Install Teamviewer =============================

cd ~/Downloads
wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
sudo dpkg -i ~/Downloads/teamviewer_amd64.deb


============= Install Gnome panel (taskbar) also used for creating Desktop shortcuts (Launchers) through GUI ============
sudo apt update
sudo apt install gnome-panel
gnome-desktop-item-edit --create-new ~/Desktop

OR

gedit ~/Desktop/Chrome-home.desktop

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/usr/bin/google-chrome --profile-directory=Default
Name=Chrome home
Comment=Chrome home
Icon=/opt/google/chrome/product_logo_256.png


gedit ~/Desktop/Chrome-work.desktop

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/usr/bin/google-chrome --profile-directory="Profile 1"
Name=Chrome work
Comment=Chrome work
Icon=/opt/google/chrome/product_logo_256.png


Then allow execution in properties.


============== Sync folders -- Unison ==============
Install from Ubuntu Software

Run via launcher:
/snap/unison-jz/19/bin/unison-2.51 -dontchmod -perms 0

Profiles stored at /home/user1/.unison/*.prf

common.prf
# Helps out a lot on Windows
fastcheck = true

# place new files at the top of the list
sortnewfirst = true

# turn on ssh compression
rshargs = -C

# Do not sync permissions
dontchmod = true
perms = 0

ignore = Name Thumbs.db
ignore = Name *~
ignore = Name *.tmp
ignore = Name _SYNCAPP
ignore = Name metadata.xml




unison profilename -batch




================== Windows software ================

 - Dropbox -- Ubuntu Software
 - Draftsight (http://dl-ak.solidworks.com/nonsecure/draftsight/2018SP1/draftSight.deb)
 - text editor: notepadqq (regular expressions not working), Geany, SciTE
 - File manager -- Double Commander
 - FTP server -- OpenSSH
 - video player -- VLC, KM Player?
 - ultraISO -- UNetbootin + sudo apt-get install isomaster
 - photo manager -- digikam (alternatives: gThumb, KPhotoAlbum, Darktable, F-Spot, GTKRawGallery, Picty, Fotoxx)
 - ebook converter -- Calibre
 - audio capture -- Audio Recorder
 - audio editor -- Audacity
 - video capture (Screen recorder) -- Open Broadcaster Software (OBS)  
 - video convert -- ?
 - Video Editor  -- Kdenlive
 - PDF Reader -- Evince


=============== Install DraftSight ======================
cd ~/Downloads
wget http://dl-ak.solidworks.com/nonsecure/draftsight/2018SP2/draftSight.deb
sudo dpkg -i ~/Downloads/draftSight.deb




================ Install Audacity ================

Install from Ubuntu Software


============== Install Calibre ====================

sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()"


====================== Install Audio Recorder ===============

sudo add-apt-repository ppa:audio-recorder/ppa
sudo apt-get -y update
sudo apt-get install --reinstall audio-recorder


========== Install digikam ===============

sudo mkdir /opt/digikam
sudo chown user1 /opt/digikam
cd /opt/digikam
wget https://download.kde.org/stable/digikam/digikam-5.9.0-01-x86-64.appimage
sudo chmod 775 digikam-5.9.0-01-x86-64.appimage
/opt/digikam/digikam-5.9.0-01-x86-64.appimage

OR  (not latest)

sudo add-apt-repository ppa:philip5/extra
sudo apt update
sudo apt install digikam5


================== Install RDP ================

https://askubuntu.com/questions/592537/can-i-access-ubuntu-from-windows-remotely

sudo apt-get update
sudo apt-get install xrdp
sudo apt-get install xfce4

echo xfce4-session >~/.xsession

sudo gedit /etc/xrdp/startwm.sh

The content should look like this (pay attention to the last line and ignore . /etc/X11/Xsession):
"
#!/bin/sh

if [ -r /etc/default/locale ]; then
  . /etc/default/locale
  export LANG LANGUAGE
fi

startxfce4
"

sudo service xrdp restart



==================================== Mount shares inside vbox ==============================

mkdir ~temp-shared
sudo mount -t vboxsf temp temp-shared
sudo nano /etc/rc.local
sudo mount -t vboxsf temp /home/user1/temp-shared


====================== Install WCM Commander (Double Commander recommended) =====================================
1. http://wcm.linderdaum.com/downloads/

#OR the latest version using GIT source:
2.1 Goto https://github.com/corporateshark/WCMCommander/
2.2 Download ZIP
2.3 Unpack
2.4 Install "Synaptic Package Manager" using "Ubuntu Software"
2.5 Using Synaptic, install packages :
libX11-dev
libfreetype6-dev
libssh2-1-dev
libsmbclient-dev
2.6 Run in WCMCommander-master
make all -B
sudo make install -d /usr/bin


================ Remote desktop via VNC ===============

vino-preferences
gsettings set org.gnome.Vino require-encryption false
#and forward port 5900 on the router
    

=============== Double Commander======================

Install from Unutu software

Configuration > Options -- "File views"->"Sorting directories"="sort like files and show first"
Configuration > Options-Colors-File types
Configuration > Options-Fonts-Main font
Configuration > Options-Icons -- 16x16
Configuration > File views -- Show system and hidden files
Configuration > Options > Behaviors > Drive black list:
/home/ssh-ate/ATE;/home/ssh-ate/Dist;/home/ssh-ate/Dist-Work;/home/ssh-ate/Docs;/home/ssh-ate/ArchiveProjects;/home/ssh-ate/SupplierInfo;/home/ssh-ate/Lang;/home/ssh-ate/Music;/home/ssh-ate/Storage;/home/ssh-ate/video;/home/ssh-ate/inbox;/run/user/1000/gvfs;/media/user1/Win;*telegram-desktop.mnt


================== Configure cron scheduled tasks ===========
gedit ~/cronjobs.txt
0 20 * * * /snap/unison-jz/13/bin/unison-2.51 Work-Backup -batch -dontchmod -perms 0
30 20 * * 5 sh ~/archive-work.sh

gedit ~/archive-work.sh
#!/bin/sh
7z a -pPASSWORD /media/d2/Inbox-d2/Backup/Work-$(date +%Y-%m-%d).7z /media/d1/Work > archive-work.log

Make it hidden and executable:
chmod 700 ~/archive-work.sh

crontab -u user1 ~/cronjobs.txt
crontab -l

grep CRON /var/log/syslog

============== Install Telegram =============
sudo add-apt-repository ppa:atareao/telegram && sudo apt update
sudo apt install telegram

Then add to Startup: telegram-desktop -- %u


================= Install OpenVPN ===============
sudo apt-get update
sudo apt-get install openvpn
sudo openvpn --config /media/d1/configfile.ovpn




============ Install OpenSSH =================
https://www.digitalocean.com/community/tutorials/how-to-enable-sftp-without-shell-access-on-ubuntu-16-04
https://en.wikibooks.org/wiki/OpenSSH/Cookbook/File_Transfer_with_SFTP#SFTP-only_Accounts

sudo apt install openssh-server

sudo mkdir -p /home/ssh-grp
sudo chown user1:grp /home/ssh-grp
sudo chgrp grp /home/ssh-grp

sudo mkdir -p /home/ssh-grp/ftp-dir1
sudo mkdir -p /home/ssh-grp/ftp-dir2

sudo chown root /home/ssh-grp


sudo gedit /etc/fstab
/media/d1/FTP/dir1 /home/ssh-grp/ftp-dir1 none bind
/media/d1/FTP/dir2 /home/ssh-grp/ftp-dir2 none bind



sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults
sudo gedit /etc/ssh/sshd_config

Port NNN
PermitRootLogin no
Subsystem sftp internal-sftp


#add to the end:

Match user user1
ChrootDirectory /media
ForceCommand internal-sftp
PasswordAuthentication yes
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

Match Group grp
ChrootDirectory /home/ssh-grp
ForceCommand internal-sftp
PasswordAuthentication yes
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no




tail -f /var/log/auth.log

sudo systemctl restart ssh


================= Hide users ===============

printf "[User]\nSystemAccount=true" | sudo tee /var/lib/AccountsService/users/user1 > /dev/null



=========== Firewall =============
https://www.digitalocean.com/community/tutorials/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server

sudo apt-get install ufw
sudo ufw status
sudo ufw app list
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 11111/tcp
sudo ufw deny OpenSSH
sudo ufw allow Samba
sudo ufw allow CUPS
sudo ufw enable
sudo ufw status


=========== File permissions =======
http://manpages.ubuntu.com/manpages/xenial/en/man8/ntfs-3g.8.html
Ownership and Permissions
sudo chown -R user1:user1 /media/d1 sudo chmod -R u+rwX,g+rX,go-w,o-rX /media/d1 sudo chown -R user1:user1 /media/d2 sudo chmod -R u+rwX,g+rX,go-w,o-rX /media/d2 sudo chgrp -R ate /media/d1/dir1 sudo chgrp -R ate /media/d1/dir2 sudo chown -R user2:home /media/d1/dir3 sudo chmod -R g+w /media/d1/dir3 sudo chmod -R o+X /media/d1/dir3 sudo chmod -R g+w /media/d1/FTP/inbox ================ Download an offline website mirror, make and mount ISO image =============== sudo apt-get install webhttrack bash process_after_httrack.sh sudo mkdir /media/user1/iso sudo mount -o loop /media/d1/Stasia/offline-websites/doctorberezovska_com_2018-02-25.iso /media/user1/iso sudo umount /media/user1/iso -----------process_after_httrack.sh--------- #!/bin/bash source_path=/media/d2/Temp/HTTrack project_name=doctorberezovska_com temp_path=/media/d1/Temp iso_path=/media/d1/Stasia/offline-websites url_prefix=http:/ pagename=index.html basepath=$temp_path/$project_name cp -r $source_path/$project_name $temp_path rm -rf $basepath/hts-cache #delete all folders "feed" find $basepath -type d -name feed -exec rm -r {} \; #delete all files index????.html find $basepath -type f -name index????.html -exec rm -r {} \; find $basepath -type f -name index.html -size 0c > empty_indexes.txt #download empty index.html files while read -ru 3 LINE; do #replace basepath with http prefix in each line urlpath=${LINE/$basepath/$url_prefix} #delete index.html in each line urlpath=${urlpath/$pagename} wget -k --output-document="$LINE" $urlpath done 3< empty_indexes.txt find $basepath -type f -name *.html > all_html.txt while read -ru 3 LINE; do #Replace http://doctorberezovska.com/ with ../ #Some links are not replaced by HTTrack. This replacement will only work for level 1 pages, but they are the majority. A universal replacement is too complicated. #Also delete trash after sed -i 's_http://doctorberezovska.com/_../_g;/<\/html>/q' $LINE done 3< all_html.txt grep Error: $basepath/hts-log.txt >errors.txt rm -rf $basepath/hts-log.txt mkisofs -r -iso-level 4 -o $iso_path/$project_name"_"$(date +%Y-%m-%d).iso $basepath rm -rf $basepath ---------------------------------------------- ========================== Burn ISO e.g. ================ sudo fdisk -l sudo umount /dev/sdd sudo dd bs=4M if=/media/d1/Dist/Util/Hdd-tools/WinPE10_8_Sergei_Strelec/WinPE10_Sergei_Strelec_x64_2018.01.05_English_lite.iso of=/dev/sdd status=progress oflag=sync OR if bootable USB flash sudo add-apt-repository ppa:gezakovacs/ppa sudo apt-get update sudo apt-get install unetbootin sudo QT_X11_NO_MITSHM=1 /usr/bin/unetbootin ====================== SVN and Git GUI client ================= sudo add-apt-repository ppa:rabbitvcs/ppa sudo apt-get update sudo apt-get install rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit rabbitvcs-nautilus rabbitvcs-nautilus3 sudo apt-get remove rabbitvcs* OR RapidSVN in UbuntuSoftware rep =========== Check existing application =============== /usr/share/applications ========== Download Youtube video ======== sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/youtube-dl ============= Separate output audio devices for each app ============================ sudo apt-get install pavucontrol pavucontrol =============== Change display resolution ============== xrandr --output HDMI-1 --mode 1920x1200 xrandr --output HDMI-1 --mode 1920x1080 xrandr --output HDMI-1 --mode 1280x960 Icon=/usr/share/icons/Humanity/apps/48/preferences-desktop-display.svg ========== Access Google Drive ========== GUI - https://www.omgubuntu.co.uk/2016/08/use-google-drive-ubuntu-16-04-linux-desktops Mount - https://www.techrepublic.com/article/how-to-mount-your-google-drive-on-linux-with-google-drive-ocamlfuse/ Mount - http://xmodulo.com/mount-google-drive-linux.html ================================ Clean up ========== sudo apt autoremove sudo apt-get autoremove sudo apt-get clean sudo apt-get autoremove --purge dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge OR (deletes Ubuntu Software Center!! so I use only log deletion from there) https://gist.github.com/Iman/8c4605b2b3ce8226b08a sudo /media/d1/Work/Settings/Linux/cleanup.sh

5 Comments

  1. Pingback: Скачивание оффлайн копии сайта — AT Engineering Co.

  2. Pingback: Опыт перехода с Windows на Linux — AT Engineering Co.

  3. Pingback: Switching from Windows to Linux – AT Engineering Co.

Leave a Reply

Your email address will not be published. Required fields are marked *