Search This Blog

Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Install nomachine on remote headless virtual machine

  • Install desktop system on the virtual machine
    sudo apt install ubuntu-desktop
  • Install nomachine for linux
  • The system display manager should be stop and disabled, otherwise, the remote desktop screen will be limited low resolution. Use the script below to do so:
    dm=$(basename "$(cat /etc/X11/default-display-manager)")
    sudo systemctl stop $dm
    sudo systemctl disable $dm
    sudo systemctl restart nxserver

Set up Epson Workforce 435 Printer on Ubuntu 20.04

I. Install Epson WorkForce 435 driver for Ubuntu Linux

  • Install lsb
    sudo apt install lsb
  • Download Epson Workforce 435 driver from OpenPrinting.org: .deb for Debian/Ubuntu x64
  • Install the Epson Workforce 435 driver:
    sudo apt install ~/Downloads/epson-inkjet-printer-201109w_1.0.0-1lsb3.2_amd64.deb
  • Go to Settings -> Printers and select the Workforce-435 printer, click the "Gear" icon then select Printer Details.
  • In the printer details window, click Select from database then select "Epson" from the left side panel, then select "Epson WorkForce 435 Series - epson-inkjet-printer 1.0.0-1lsb3.2" at the bottom of the right side panel.



II. Fix printer error caused by apparmor

At this point, the Epson WorkForce 435 driver has been installed. However, printing to the printer is still not working. You may see error message pops up: "Printer error - connecting to device". This is because the driver we've installed is from 3rd party. The Ubuntu apparmor protects cupsd from accessing this driver. To solve the issue:
  • Install apparmor-utils
    sudo apt install apparmor-utils
  • sudo aa-complain cupsd; sudo aa-complain cups-browsed
  • Restart the computer.
  • Print a test page. If it works, check /var/log/syslog and look for apparmor related lines and see if any permissions need to be added to /etc/apparmor.d/usr.sbin.cupsd or /etc/apparmor.d/usr.sbin.cups-browsed
  • sudo app-enforce cupsd; sudo aa-enforce cups-browsed
  • Restart the computer and make sure the printing is still works.



See also

Ubuntu Gnome: swap Ctrl key with Win/CMD key

  • Install gnome-tweaks
  • Start Tweaks, select Keyboard and Mouse from the left side bar, then click Additional Layout Options button:
  • Open Ctrl position, check Swap Left Win with Left Ctrl

Ubuntu Linux: mount smb share with utf8 encoding

The default encoding for smb mounts is iso8859-1. To mount the smb share with utf8 encoding:
sudo mount -t cifs //SERVER/SHARE1 /mnt/SHARE1 -o username=USER,domain=DOMAIN,iocharset=utf8



If you got
error: mount error 79 = Can not access a needed shared library.
, you will need install linux-modules-extra-$(uname -r):
sudo apt-get install linux-modules-extra-$(uname -r)
or
sudo apt-get install linux-modules-extra-$(uname -r)-generic

Remote desktop to Ubuntu Linux via x2go


I. Install X2Go server on the remote Ubuntu Linux host

  1. Add the X2Go repository:
    sudo add-apt-repository ppa:x2go/stable
    and confirm this with [Enter]. Then, update the package lists:
    sudo apt-get update
  2. Install the X2Go server:
    sudo apt-get install x2goserver x2goserver-xsession
  3. Install extra bindings depend on what window manager you use:
    • for LXDE:
      sudo aptitude install --reinstall lxde lxsession-logout x2golxdebindings
    • for GNOME:
      sudo apt-get install x2gognomebindings
      GNOME only works for versions earlier than gnome 3.10, better earlier than gnome 3.08
    • for KDE:
      sudo apt-get install plasma-widget-x2go
  4. Test if the service is up and running:
    sudo service --status-all | grep x2go
    If not, try starting it manually:
    sudo service x2goserver start

II. Install X2Go Client on the local computer

  • Windows: Download and install the newest windows client from the X2Go website
  • Linux:
    sudo apt-get install x2goclient
  • Mac OS:

III. Connect to remote Linux host using X2Go client

  • For Mac OS, starts XQuartz first then X2Go client. You need to set the prefences of XQuartz to allow connections:






See also

Enable livepatch on Ubuntu Linux 16.04 LTS

  1. Install snapd:
    sudo apt-get install snapd
  2. Install the canonical-livepatch snap:
    sudo snap install canonical-livepatch
  3. Go to https://ubuntu.com/livepatch and retrieve your livepatch token
  4. Enable the service with your token:
    sudo /snap/bin/canonical-livepatch enable [TOKEN]
  5. You can check the status at any time using:
    sudo /snap/bin/canonical-livepatch status --verbose



See also

Install MyTardis on Ubuntu Linux 16.04

  1. Create a service user account for running MyTardis:
    useradd -m -d /opt/mytardis -s /bin/bash tardis
  2. Check out MyTardis from github:
    cd /opt
    sudo git clone -b master https://github.com/mytardis/mytardis.git
    sudo chown tardis:tardis /opt/mytardis
  3. Install required ubuntu packages:
    sudo bash /opt/mytardis/install-ubuntu-requirements.sh
  4. Setup virtualenv for tardis account:
    sudo su tardis
    source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
    mkvirtualenv --system-site-packages mytardis
    pip install -U pip
    echo "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh" >> ~/.bashrc
    echo "workon mytardis" >> ~/.bashrc
    source ~/.bashrc
  5. (As user 'tardis',) To work around this bleach bug, set html5lib version by adding line below to requirements.txt:
    html5lib==0.9999999
  6. remove billiard from requirements.txt or after installing the required packages, re-install celery package to downgrade billiard to 3.3.0.23. This is because the installed billiard 3.5.0.0 is installed and it causes celery failed to process any task. (Thread ResultHandler crashed: TypeError ...)
  7. (As user 'tardis',) Install required Python packages:
    cd /opt/mytardis
    pip install -U -r requirements.txt
  8. (As user 'tardis',) Initialize tardis/settings.py (as user 'tardis'):
    cd /opt/mytardis
    mv tardis/settings_changeme.py tardis/settings.py
    add the following lines:
    DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
    DATABASES['default']['NAME'] = 'tardis_db'
    
  9. (As user 'tardis',) Generate SECRET_KEY and save to tardis/settings.py:
    echo "SECRET_KEY='`python mytardis.py generate_secret_key`'" >> tardis/settings.py
    or to re-generate:
    python -c "import os; from random import choice; key_line = '%sSECRET_KEY=\"%s\"  # generated from build.sh\n' % ('from tardis.default_settings import * \n\n' if not os.path.isfile('tardis/settings.py') else '', ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789\\!@#$%^&*(-_=+)') for i in range(50)])); f=open('tardis/settings.py', 'a+'); f.write(key_line); f.close()"
  10. (As user 'tardis',) Initialize database:
    python mytardis.py migrate
  11. (As user 'tardis',) Create cache tables:
    python mytardis.py createcachetable default_cache
    python mytardis.py createcachetable celery_lock_cache
  12. (As user 'tardis',) Collect static files and save to static/ directory under /opt/mytardis:
    python mytardis.py collectstatic
  13. (As user 'tardis',) Create superuser (as user 'tardis'):
    python mytardis.py createsuperuser
  14. (As user 'tardis',) Create var/store directory:
    mkdir -p var/store
  15. (As user 'tardis',) Start mytardis server:
    python mytardis.py celeryd &
    python mytardis.py runserver 0.0.0.0:8000
    Note: 1) celeryd has to be started manually prior mytardis; 2) append 0.0.0.0:8000 to runserver command will make the server serve other hosts rather than only localhost:8000
  16. Supervisor can be installed to auto-start celeryd and webserver...

Start Mediaflux server on system reboot using systemd on Ubuntu Linux 16.04

  1. Modify mediaflux script file from $MFLUX_HOME/bin/unix/mediaflux and install it to /etc/init.d/mediaflux.
  2. create systemd unit file at /lib/systemd/system/mediaflux.service
    [Unit]
    Description=Mediaflux Server
    After=remote-fs.target
       
    [Service]
    Type=forking
    ExecStart=/etc/init.d/mediaflux start
    ExecStop=/etc/init.d/mediaflux force-stop
    
    [Install]
    WantedBy=multi-user.target
    
  3. Enable the systemd unit (so that it is called on reboot)
    sudo systemctl enable mediaflux.service
  4. Start the service manually(without reboot)
    sudo systemctl start mediaflux.service

see also

Ubuntu Linux 16.04 systemd unit file for Mediaflux server

[Unit]
Description=Mediaflux Server
After=remote-fs.target
   
[Service]
Type=forking
ExecStart=/etc/init.d/mediaflux start
ExecStop=/etc/init.d/mediaflux force-stop

[Install]
# IMPORTANT: The following line is to insert the service to the dependency tree. Otherwise, it will not be called on system reboot.
WantedBy=multi-user.target

see also

Install mate-desktop on Ubuntu 14.04 LTS

sudo apt-add-repository ppa:ubuntu-mate-dev/ppa
sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate
sudo apt-get update
sudo apt-get install ubuntu-mate-core ubuntu-mate-desktop
After installation, log out and select MATE session then re-login.

Ubuntu: system wide proxy settings

  • edit /etc/bash.bashrc
    export http_proxy=http://192.168.1.100:8000/
    export https_proxy=http://192.168.1.100:8000/
    export ftp_proxy=http://192.168.1.100:8000/
    export no_proxy=localhost,127.0.0.0/8,192.168.0.0/16,*.somedomain.org,172.23.65.*

Install thinkfan fan control utility on Lenovo thinkpad laptops

I.Installation

  1. Install thinkfan from repository:
    sudo apt-get install thinkfan
  2. Enable fan control in thinkpad_acpi module configuration:
    sudo echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkpad_acpi.conf
  3. Reload thinkpad_acpi module:
    sudo rmmod thinkpad_acpi; sudo modprobe thinkpad_acpi
  4. Set to start thinkfan automatically at boot time:
    sudo vi /etc/defaults/thinkfan
    START=yes

II.Customization

  1. Install lm-sensors:
    sudo apt-get install lm-sensors
  2. To check the temperatures of the sensors:
    sensors
  3. To modify the thinkfan fan control settings:
    sudo vi /etc/thinkfan.conf

Ubuntu: Some index files failed to download

Symptom:
When running sudo apt-get update got the following error:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise-backports/universe/i18n/Index  No Hash entry in Release file /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise-backports_universe_i18n_Index

E: Some index files failed to download. They have been ignored, or old ones used instead.

Solution:
sudo rm -rf /var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise-backports_universe_i18n_Index
sudo apt-get update

Show apt-get (dpkg) history

/var/log/apt/history.log is the log file for apt-get install/remove: for example I want to find the command that I installed okular package:
cat /var/log/apt/history.log | grep Install | grep okular
This is useful if you want to find all the packages that were included automatically when you install a particular package. So that you can remove them all.

If the package was installed using dpkg command, you can find the log in /var/log/dpkg.log
cat /var/log/dpkg.log | grep adobereader

Debian/Ubuntu Gnome: add folder to Places menu (Bookmarks in the left side bar)

There is Bookmarks menu in the file explore. To add a bookmark folder, select the folder then select Bookmarks menu and click Add.

apt-get install flashplugin-installer and ttf-mscorefonts-installer via proxy

My desktop has not direct internet access but goes through a proxy. It fails to install the packages like flashplugin-installer or ttf-mscorefonts-installer. There are 2 solutions:
  • edit /etc/wgetrc
    sudo vi /etc/wgetrc
    http_proxy = http://your-proxy.your.org:3128
    substitude the proxy address and the port 3128 with your proxy address and port number. Save the file then run
    sudo apt-get install flashplugin-installer ttf-mscorefonts-installer
  • or for one-off installation:
    sudo http_proxy=http://your-proxy.your.org:3128 apt-get install flashplugin-installer ttf-mscorefonts-installer

add-apt-repository works through a http proxy







Solution:
export http_proxy=http://<proxy>:<port>
export https_proxy=http://<proxy>:<port>
sudo -E apt-add-repository <repository>





Ubuntu 13.10: No dropbox tray icon

Solution:
sudo apt-get install libappindicator1

Check if your ubuntu linux is affected by openssl heart bleed bug

The heart bleed bug affects openssl 1.0.1 built before 7 April 2014.
  • Check your openssl version and build time using the following command:
    openssl version -a
    If the version is 1.0.1 and build time is before 7 April 2014 (exclude 7 April 2014), your openssl is affected.
  • To patch your openssl, simply run the following commands to upgrade your openssl:
    sudo apt-get update
    sudo apt-get install openssl libssl1.0.0

install pydicom and pynetdicom on ubuntu linux

sudo aptitude install mercurial
hg clone https://code.google.com/p/pydicom/
cd pydicom/source/; sudo python setup.py install
It will be installed into /usr/local/lib/python2.7/dist-packages/pydicom-1.0.0a-py2.7.egg

To install pynetdicom:
hg clone https://code.google.com/p/pynetdicom/
cd pynetdicom/source/; sudo python setup.py install
It will be installed into /usr/local/lib/python2.7/dist-packages/netdicom