Lightweight xfce4 Setup for AWS t2.nano with Ubuntu image and remote tightVNC access

A good place to start reading and understanding what is needed for a GUI

https://help.ubuntu.com/community/Installation/LowMemorySystems

My configuration is below for a minimum system that I consider to be a useable starting point.

sudo apt install xfce4 xfce4-goodies
sudo apt install tightvncserver
tightvncserver :1
sudo apt-get install gnome-icon-theme-full tango-icon-theme
sudo apt install gksu
sudo apt install synaptic
sudo apt install chromium-browser
sudo apt install gedit

open gedit and edit the file /usr/share/applications
change Exec= to “Exec=gksudo synaptic”

Total drive size is 2.144gb when run on the AWS Ubuntu image

Create a partition for the swap so applications have access to more RAM

sudo dd if=/dev/zero of=/mnt/swap.0 bs=1024 count=1048576
sudo mkswap /mnt/swap.0

Add to fstab to automatically mount the partition

sudo su 
echo "/mnt/swap.0 swap swap defaults 0 0" >> /etc/fstab
swapon /mnt/swap.0

Check your work

sudo swapon -s

https://docs.bitnami.com/installer/faq/linux-faq/#how-to-download-and-install-a-bitnami-stack

How to setup lxde tightVNCserver on AWS t2.nano

This will install the most basic desktop environment without any browser or package managers etc. It’s very limited and in my opinion not worth the extra configuration to get it up and running.

# Make sure Debian is the latest and greatest

sudo apt update && sudo apt upgrade

# Install X, LXDE, VPN programs

sudo apt install xorg lxde-core tightvncserver

# Start VNC to create config file and setup your password

tightvncserver :1

# To stop VNC sever if needed

tightvncserver -kill :1

https://www.vandorp.biz/2012/01/installing-a-lightweight-lxdevnc-desktop-environment-on-your-ubuntudebian-vps/

I did not need to follow these steps and tight VNC Server was working

# Edit config file to start session with LXDE: 
nano ~/.vnc/xstartup 

# Add this at the bottom of the file: 
lxterminal & 
/usr/bin/lxsession -s LXDE &

 

 

Setting up OctoPi (OctoPrint) with Email Notifier yagmail

I found a few guides to this on the internet but none of them worked for me out of the box using the latest (as of today) Octopi image and a Raspberry Pi 3. What I did eventually get to work was the following

  1. Login to your raspberrypi using SSH. I use Bitvise SSH for all my SSH needs.
  2. Run a few commands to make sure your octoprint is setup correctly. The explanation for the lines is as follows. Activate octoprint environment -> install yagmail (probably already installed) -> install keyrings.alt which is needed by yagmail -> activate python -> run the yagmail registration command
    source ~/oprint/bin/activate
    pip install yagmail
    pip install keyrings.alt
    python
    import yagmail
    yagmail.register('youraccount@gmail.com', 'yourpassword')
  3. While you’re here do a test run to make sure you can connect (this will only work for Gmail SMTP servers. It’s possible to get it working with other servers but you would have to modify some source code to get the ports right. Much easier to just use Gmail)
    yagmail.SMTP(user='youraccount@gmail.com')

    You should get back

    <yagmail.yagmail.SMTP instance at ...>
  4. Install “Email Notifier” through the OctoPrint web interface if you haven’t already.
  5. Restart your RaspberryPi – This may seem unnecessary but I highly recommend it. I ran into lots of problems with emails not sending that were fixed by a simple reboot.

How to move OcotoPi (OctoPrint on Raspberry Pi 3+) to a new Network

If you’re renaming your network or taking your OctoPi & Printer on the road you may need to change the name and credentials of the Wifi network to work. It’s not hard to do but you will need to connect to the Raspberry Pi console directly. This is when having the Raspberry PI LCD screen comes in really handy.

Once you’re looking at the Raspberry Pi console the network setup file is in

/boot/octopi-network.txt
sudo nano /boot/octopi-network.txt

You will recognize this file from initial setup. Just change the name and password to the new network and reboot.

Handy Linux Commands

Get the size of the folders in any directory

du -sh folder_location/*

Search for content of a file from the command line

grep [--include=file_pattern.extension] -rnwl "matching pattern"
http://stackoverflow.com/questions/16956810/finding-all-files-containing-a-text-string-on-linux

Create a new SVN Repo

sudo svnadmin create /svn/repos/repo_name
sudo chown -R www-data:www-data /svn/repos/repo_name

Remove Directory and Contents

rm -r mydir

List CPU Usage of running processes

top

Get Wireless Signal Information

iwconfig

will save in /tmp/file_list_$FOLDER an alphabetically ordered list of all the files inside $FOLDER, complete with the corresponding sub-folders

find $FOLDER -type f | cut -d/ -f2- | sort > /tmp/file_list_$FOLDER

1and1 Cloud Hosting Odoo Install – Ubuntu 14.04

You can install Odoo from the Bitnami package but I wanted to have it from source so that I could make changes and get updates with the git commands.

I followed this guide to get started

https://www.linode.com/docs/websites/cms/install-odoo-9-erp-on-ubuntu-14-04

Which got me most of the way there but I still had 2 problems.


 

1 creating the database gave me an error

DataError: encoding UTF8 does not match locale en_US DETAIL: 
The chosen ****** setting requires encoding LATIN1.

To fix this I ran the following commands

sudo su postgres

psql

update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;

update pg_database set datistemplate=true where datname='template1';

 


 

Then once I had created my database I got an error at the top of the page

/usr/bin/env : node: No such file or directory in ovoo v9
– /website/static/src/less/import_bootstrap.less
– /web/static/src/less/variables.less
– /web/static/src/less/enterprise_compatibility.less
– /web/static/src/less/utils.less
– /web/static/src/less/modal.less
– /web/static/src/less/notification.less
– /base_import/static/src/less/import.less
– /web_tip/static/src/less/tip.less
– /web_calendar/static/src/less/web_calendar.less
– /web_diagram/static/src/less/diagram_view.less
– /web_kanban/static/src/less/kanban_dashboard.less
– /web_kanban/static/src/less/kanban_view.less
– /web_settings_dashboard/static/src/less/dashboard.less

To fix follow the instructions from the NodeJS Website:

curl -sL https://deb.nodesource.com/setup_0.10 | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g npm

Then install Less and accessories:

 sudo npm install -g less less-plugin-clean-css

Odoo 9 Step By Step Install Guide – Linux Ubuntu Lubuntu Debian

Unfortunately Odoo has intentionally made their community edition a little on the difficult side to install. I can only assume this is to drive people to their paid SaaS model. To balance this I’ve put together a guide to getting Odoo up and running and I’ll add updates as I implement and deploy new functionality.

  1. Download Odoo from their website – You’ll want to pick Odoo 9 Community for Linux
    https://www.odoo.com/page/download
    The pick “Latest Debian 9.0” as your download

The install script does a pretty good job setting up new users and getting things installed and put into the correct place. One very critical step that it does leave out is getting Postgresql configured properly. So that’s step 2. You will see a 500 Internal Server Error if you try to access http://localhost:8069 at this point

  1. Setup Postgresql user
    1. Postgresql should have already been installed but if it wasn’t you can use this command to do it from the terminal “sudo apt-get install postgresql
    2. if you get the message “No passwd entry for user postgres” you probably need to do t his
  2. Well need to create a new user and password that odoo can use to access the database – You can do that with these 2 commands
    1. Switch to postgresql user “sudo su – postgres”
    2. Execute the command “createuser –createdb –username postgres –no-createrole –no-superuser –pwprompt odoo
    3. You will be asked to create and confirm a password – This is the password that will protect your odoo database so make it something good and then remember it – you will need it again
    4. Type “exit” to get back to your previous user
  3. Edit the Odoo config file which is cryptically still called “openerp” even though they changed the name of the software quite some time ago
    1. the file is located in “/etc/odoo/openerp-server.conf
    2. on Lubuntu the command would be “sudo leafpad /etc/odoo/openerp-server.conf” just replace leafpad with “gedit” if you are on ubuntu or your favorite text editor
    3. You need to change the 2 lines for “db_user” and “db_paspsword” to odoo and the password you chose before
    4. also add “logfile =/var/log/odoo/odoo-server.log” to the end of the config file so you can track down log files if you need to
  4. You should now have Odoo up and running at “http://localhost:8069“!
    1. You will get a first configuration screen to setup a new database for your instance
    2. Go ahead and pick your password which will be the default password for your administrator user
    3. The default user name (which it wont tell you) is “admin” with the password you picked
    4. Note: if you change the email address of the admin user you will then login with that email address instead of admin

 

Let me know if you run into trouble!