Ubuntu 20.4

From MyUbuntu
Jump to navigation Jump to search

Installing Software

General Things

Install Languages following request Install gnome-tweak-tool and synaptic sudo apt-get install gnome-tweaks sudo apt-get install synaptic Choose Workspaces static. This and the number of workspace is changed with gnome tweak tool Install Extras sudo apt-get install ubuntu-restricted-extras sudo apt-get install flashplugin-installer sudo apt-get install nautilus-dropbox sudo apt-get install libappindicator1 sudo apt-get install rar To enable Control-Alt-Backspace to kill X server sudo dpkg-reconfigure keyboard-configuration hit enter to accept curernt values until you get to the item Control-Alt-Backspace

To Hide User List in Ubuntu 18.04 Login Screen Become root

sudo -i Then switch to user gdm, which is required to run gsettings to configure gdm settings.

su gdm -s /bin/bash Finally hide user list from login screen using Gsettings:

gsettings set org.gnome.login-screen disable-user-list true Install unison sudo apt-get install unison sudo apt-get install unison-gtk Install keepassx: use synaptic Install sshd in the server sudo apt install openssh-server Then enable Xforward in /etc/ssh/ssh_config an /etc/sshd_config

To have passwords stored sudo apt-get install libgnome-keyring0

Skype

Open "Software & Updates" and enable Canonical partners repository under Other Software tab. Then do sudo apt-get update sudo apt-get install skypeforlinux

Telegram

Install with sudo snap install telegram-desktop

Emacs and LaTeX (and Text in general)

For editing and text processing install: emacs, latex, ispell, auctex sudo apt-get install emacs texlive auctex bibtool sudo apt-get install texlive-bibtex-extra texlive-formats-extra texlive-fonts-extra texlive-lang-portuguese texlive-science sudo apt-get install ispell iportuguese sudo apt-get install latex2html sudo apt install texlive-publishers sudo apt install texlive-pstricks For latex2html copy the file .latex2html-init from the previous installation to preserve your definitions. For auctex to work you have to add the following lines to your .emacs file (require 'tex-site) (add-hook 'LaTeX-mode-hook 'turn-on-reftex) (setq reftex-enable-partial-scans t) (setq reftex-save-parse-info t) (setq reftex-use-multiple-selection-buffers t) (setq reftex-plug-into-AUCTeX t)

(setq reftex-texpath-environment-variables '("TEXINPUTS")) (setq reftex-bibpath-environment-variables '("BIBINPUTS")) Emacs: To change between fixed number of columns and wrap text Writing with emacs is simpler in auto-fill-mode with a fixed number of columns (70 for instance). But sometimes we have to copy this text into online forms where you want it wrapped. To do this do the following

Change into a fill mode with a large number of columns. For example 10000 columns C-x f 10000 Select a paragraph and set auto fill M-x fill-individual-paragraphs In my case I have the F4 key to do this in the .emacs file

If you want you can set back to 70 columns C-x f 70 Problem with d-bus. If you get (emacs:24886): GConf-WARNING **: Client failed to connect to the D-BUS daemon: Failed to connect to socket /tmp/dbus-7vPUX2fQ7b: Connection refused it is probbaly caused by .dbus subdir being owned by root:root. Change it

sudo chown -R user:user .dbus How to print in color with a2ps a2ps --pro=color -o output.ps infile.txt or for output in one page

a2ps -1 --pro=color -o output.ps infile.txt Problem with indent in environment align Customize LaTeX-indent-environment-list:

M-x customize-variable RET LaTeX-indent-environment-list RET and uncheck align and align* The changes are save in .emacs

To change tab space in a file M-x set-variable RET tab-width RET 4 4 is an example of course. This works only for the session.

Email

For email install thunderbird and the extensions sudo apt-get install thunderbird sudo apt-get install xul-ext-ubufox xul-ext-calendar-timezones xul-ext-gdata-provider xul-ext-lightning Add extensions: Provider for Google Calendar gContactSync

Chrome

Download from google the .deb package for 64 bits Install using dpkg -i google-chrome-stable-xxx If you have problems with dependencies do sudo apt-get install -f

Graphics

Installation

For graphics and plots install: gnuplot, gimp,gv sudo apt-get install gnuplot gimp gv In gnuplot to see the options of a given terminal do test The 75 and 100 dpi fints are no longer installed by default, Install and set the path: sudo apt-get install xfonts-75dpi xfonts-100dpi xset +fp /usr/share/fonts/X11/75dpi/ xset +fp /usr/share/fonts/X11/100dpi/


Problems

Problems with ImageMagick. sudo nano /etc/ImageMagick-6/policy.xml Comment the following lines

To avoid warnings in convert use convert -quiet


Tricks for gnuplot

Make 1D histograms with gnuplot binwidth=2 bin(x,width)=width*floor(x/width) plot 'file.dat' using (bin($1,binwidth)):(1.0) smooth freq with boxes

Compilers and Maths=

gnu compilers, at and octave

sudo apt-get install build-essential sudo apt-get install at sudo apt-get install octave


Mathematica

Install fonts for Mathematica (if not yet installed) sudo apt-get install ttf-mscorefonts-installer To mount the server to get Mathematica at IST do sudo apt-get install cifs-utils mkdir Mathematica sudo mount -t cifs -o user=istxxxxx //delta.tecnico.ulisboa.pt/Mathematica Mathematica Copy the folder and install

Fortran

Install ifort copying what is in /opt Install prgrams in /usr/local. Normally just copy them there from the Backup


LoopTools

To be able to use the ifort compiler compile and install in an user directory. This is because then ifort is defined in the shell. The commands are ./configure make install make -f makefile.quad-ifort install Then copy the subdirs in x86_64-Linux to /usr/local/lib/LoopTools

To be able to use LoopTools in quad precision there is no need to use F90, but you have to change the program as follows Change real*8 into real*16 and complex*16 into complex*32 Change all the double precision constants. For instance 2d0 goes into 2q0 The Fortran flags must be like in the following Makefile FC = ifort

LT = /usr/local/lib/LoopTools


FFLAGS = -c -O -r16 -DDBLE=QEXT -DDIMAG=QIMAG -DDCONJG=QCONJG -DDCMPLX=QCMPLX -I$(LT)/include

LDFLAGS =

LINKER = $(FC)


LIB = -L$(LT)/lib64 -L/usr/local/lib/Cuba LIBS = -looptools-quad -lcuba

.F.o: $(FC) $(FFLAGS) $*.F .f.o: $(FC) $(FFLAGS) $*.f


files = FinalResult-quad.o

all: $(files) $(LINKER) $(LDFLAGS) -o FinalResult-quad $(files) $(LIB) $(LIBS)

The reason for the above flags is explained by Thomas Hahn (LoopTools) as follows 1. The 'barefoot' method is: replace all REAL*8 or double precision

  by REAL*16, and COMPLEX*16 or double complex by COMPLEX*32.
  You don't strictly need F90 for that but the only compilers
  able to do it are F90 compilers anyway (except for some old
  Unix flavors) and you don't need to change the code to
  free-format F90 since F90 will also understand fixed-format F77.

2. If you have a double-precision program, the compiler can

  automatically upgrade it to quadruple precision, using
  -r16 (ifort) or -fdefault-real-8 (gfortran).  There is one
  catch, however: explcitly typed Fortran functions won't be
  upgraded.  For example, if you wrote y = dsin(x), rather than
  y = sin(x), the sine will not be upgraded to quad precision.
  And even if you did your homework, there are four functions
  which are not automatically upgraded: DBLE, DIMAG, DCONJG,
  and DCMPLX.  That is, if you write y = CONJG(x) this is not
  type independent but truncates x to single precision before
  assigning to y.
  That said, in my own programs I spell out those four functions
  in CAPS so that I can easily replace them with compiler flags, too:
  -DDBLE=QEXT -DDIMAG=QIMAG -DDCONJG=QCONJG -DDCMPLX=QCMPLX

Upshot: while the second part seems much more work than the first, if you stick to some (relatively simple) coding rules (prefer untyped functions over typed functions, write out the four functions above in CAPS) you can just switch to double precision with compiler flags, which is just what LoopTools does.

In a nutshell: - dsin -> sin, datan -> atan, csqrt(x) -> sqrt(DCMPLX(x)), etc. - dreal -> DBLE, dble -> DBLE, dconjg -> DCONJG etc. - compile with

 -r16 -DDBLE=QEXT -DDIMAG=QIMAG -DDCONJG=QCONJG -DDCMPLX=QCMPLX (ifort)
 -fdefault-real-8 -DDBLE=QEXT -DDIMAG=QIMAG -DDCONJG=QCONJG -DDCMPLX=QCMPLX (gfortran)

Let me finally point out the subtle difference between dreal and dble. The former is a (non-standard, at least non-77-standard) function to take the real part, the second is a typecast (usually from double complex to double). This explains why DBLE and DCMPLX but not why DCONJG etc. are special.

Apache MySQL and PHP Server

Install the LAMP Server: Apache, MySQL and PHP sudo apt-get install apache2 sudo apt-get install php php-cgi libapache2-mod-php php-common php-pear php-mbstring For mysql things have changed. After installation sudo apt install mysql-server you have to run

sudo mysql_secure_installation answer yes to all questions and set the root password. To acces the mysql as root you have to be superuser

sudo mysql -u root -p All users have to have a password.

Enable cgi for PHP sudo a2enconf php7.2-cgi sudo systemctl reload apache2.service To enable User Dirs in public_html sudo a2enmod userdir sudo service apache2 restart To enable PHP in public_html: In /etc/apache2/mods-available/php7.0.conf, change the following <IfModule mod_userdir.c>

   <Directory /home/*/public_html>
       php_admin_flag engine Off
   </Directory>

</IfModule> to

  1. <IfModule mod_userdir.c>
  2. <Directory /home/*/public_html>
  3. php_admin_flag engine Off
  4. </Directory>
  5. </IfModule>

Copy from the old system the sites available that you want to keep and enable them sudo aensite site_name Note:The sites available have to have the .conf extension to be read by a2ensite

To avoide the error "Could not reliably determine the server's fully qualified domain name", create the file sudo nano /etc/apache2/conf-available/fqdn.conf and write there

ServerName localhost or proper name if you have one then

sudo a2enconf fqdn To check missing links in web sites install sudo apt-get install linkchecker sudo apt-get install linkchecker-gui

Allowing www-data group in UserDir directories

Sometimes you want some programs in your public_html directory. For that you have to ask the system manager to do the following

First, add yourself into the group www-data sudo usermod -a -G www-data (your username) Then: sudo chgrp www-data /home/myuser/public_html/folderA sudo chmod g+rwxs /home/myuser/public_html/folderA Should do the trick unless the permissions on your /home/myuser do not permit other users access. The first command changes the group ownership of the folder to that of the webserver. The second command gives members of the www-data group read, write, enter-directory rights, and the group s flag will ensure that any files that get created inside that directory take www-data as the group - so if you create a file as myuser the www-data user will have access.

Install Apache with SSL

Get the software if not yet installed sudo apt-get install apache2 sudo apt-get install ssl-cert Enable ssl sudo a2enmod ssl Configure ssl sudo cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/ssl.conf sudo a2ensite ssl sudo service apache2 restart The file /etc/apache2/sites-available/ssl.conf looks like <IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost

DocumentRoot /var/www/htmls

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn, ...

</VirtualHost> </IfModule> To password protect in /etc/apache2/sites-available/ssl.conf, insert before </VirtualHost> <Directory "/var/www/htmls/some_dir> AuthType Basic AuthName "Restricted Files" AuthUserFile /etc/apache2/passwd/passwords Require user some_user </Directory> Passwords are created with the command sudo htpasswd To list options htpasswd --help

Install SSL Certificates

This is taken from https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04

Introduction This tutorial will show you how to set up a TLS/SSL certificate from Let’s Encrypt on an Ubuntu 16.04 server running Apache as a web server. We will also cover how to automate the certificate renewal process using a cron job.

SSL certificates are used within web servers to encrypt the traffic between the server and client, providing extra security for users accessing your application. Let’s Encrypt provides an easy way to obtain and install trusted certificates for free.

Prerequisites An Ubuntu 16.04 server with a non-root sudo user, which you can set up by following our Initial Server Setup guide The Apache web server installed with one or more domain names properly configured through Virtual Hosts that specify ServerName. When you are ready to move on, log into your server using your sudo account.

Step 1 — Install the Let's Encrypt Client First, we will download the Let’s Encrypt client from the official repositories. Although the Let's Encrypt project has renamed their client to certbot, the client included in the Ubuntu 16.04 repositories is simply called letsencrypt. This version is completely adequate for our purposes.

sudo apt-get update sudo apt-get install python-letsencrypt-apache The letsencrypt client should now be ready to use.

Step 2 — Set Up the SSL Certificate Generating the SSL Certificate for Apache using the Let’s Encrypt client is quite straightforward. The client will automatically obtain and install a new SSL certificate that is valid for the domains provided as parameters.

To execute the interactive installation and obtain a certificate that covers only a single domain, run the letsencrypt command like so, where example.com is your domain:

sudo letsencrypt --apache -d example.com After the dependencies are installed, you will be presented with a step-by-step guide to customize your certificate options. You will be asked to provide an email address for lost key recovery and notices, and you will be able to choose between enabling both http and https access or forcing all requests to redirect to https. It is usually safest to require https, unless you have a specific need for unencrypted http traffic.

When the installation is finished, you should be able to find the generated certificate files at /etc/letsencrypt/live. You can verify the status of your SSL certificate with the following link (don’t forget to replace example.com with your base domain):

https://www.ssllabs.com/ssltest/analyze.html?d=example.com&latest You should now be able to access your website using a https prefix.

Step 3 — Set Up Auto Renewal Let’s Encrypt certificates are valid for 90 days, but it’s recommended that you renew the certificates every 60 days to allow a margin of error. The Let's Encrypt client has a renew command that automatically checks the currently installed certificates and tries to renew them if they are less than 30 days away from the expiration date.

To trigger the renewal process for all installed domains, you should run:

sudo letsencrypt renew Because we recently installed the certificate, the command will only check for the expiration date and print a message informing that the certificate is not due to renewal yet. The output should look similar to this:

  Processing /etc/letsencrypt/renewal/example.com.conf
  The following certs are not due for renewal yet:
    /etc/letsencrypt/live/example.com/fullchain.pem (skipped)
    No renewals were attempted.

A practical way to ensure your certificates won’t get outdated is to create a cron job that will periodically execute the automatic renewal command for you. Since the renewal first checks for the expiration date and only executes the renewal if the certificate is less than 30 days away from expiration, it is safe to create a cron job that runs every week or even every day, for instance. Include the following content at the end of the crontab, all in one line:

30 2 * * 1 /usr/bin/letsencrypt renew >> /var/log/le-renew.log Save and exit. This will create a new cron job that will execute the letsencrypt-auto renew command every Monday at 2:30 am. The output produced by the command will be piped to a log file located at /var/log/le-renewal.log.

OwnCloud and SSL

OwnCloud Upgrades

OwnCloud Upload Folders

Owncloud Repair Files

Owncloud Unlock Files

MySQL

PHP

Installation Questions

Connection with MySQL

To use with Emacs

MediaWiki

Install Mediaki in Ubuntu 16.04

Export the Mediawiki Database in SQL

Export into site with all the files

Import the Mediawiki Database in SQL

Import the Mediawiki Database in from HTML

Secure LocalSettings.php

Cleaning

Change Setting to see errors

Java

Adobe Reader

Rotate a PDF under Ubuntu Linux

Dvips fonts

Sendmail and alpine

Other Software

MS Fonts

Firewall

Stop avhai-deamon

Tunning

Grub screen resolution

Disable Password after Suspend

Cleaning up

Change boot order in grub

Setting smart host in sendmail

System Load Indicator