Sunday, December 11, 2022

How to install Ubuntu LXC Container with Desktop GUI

This guide will help you install Ubuntu desktop GUI from a Proxmox Standard Ubuntu 22.04 container template.

Start with updating APT

# apt update


Edit APT sources list with this (you may need to change jammy to your version code name)

# nano /etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu jammy partner
deb-src http://archive.canonical.com/ubuntu jammy partner


Update again

# apt update

Install XFCE & X11

apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils

Install XRDP (so we can remote control using RDP)

apt install xrdp

Make sure XRDP is installed and running

# systemctl status xrdp

Set which X-Session should be use

update-alternatives --set x-session-manager /usr/bin/xfce4-session

Reboot and Test

update-alternatives --set x-session-manager /usr/bin/xfce4-session





Monday, July 4, 2022

MySQL command to export CSV file from SQL query

Here is the command to export a particular MySQL table to CSV file:

Here is the syntax:

mysql -u root -p 123password123 -D mydatabase -e "SELECT * FROM product WHERE edu_price > 0 INTO OUTFILE '/tmp/edu.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY 'n';"

Break down details of the individual options:

-u (user)

-p (password)

-D (database)

 -e (execute command)

after the query add the following SQL Command:

INTO OUTFILE '/path/filename.csv'

FIELDS TERMINATED BY ','

ENCLOSED BY '"'

LINES TERMINATED BY 'n';

---------------

Please make sure to add ';' (semicolon) at the end of the MySQL command to end the SQL command.


How to execute MySQL command from command line

 Being able to execute a MySQL command from command line or from a Shell Script is very useful sometime.  A good example would be to schedule a particular MySQL SQL command to be executed in crontab.

Here is the syntax:

mysql -u root -p 123password123 -D mydatabase -e "SELECT * FROM product WHERE edu_price > 0 INTO OUTFILE '/tmp/edu.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY 'n';"

Break down details of the individual options:

-u (user)

-p (password)

-D (database)

 -e (execute command)


Monday, April 25, 2022

How to fix "The method driver /usr/lib/apt/methods/https could not be found."

ISSUE:

apt-get update

E: The method driver /usr/lib/apt/methods/https could not be found.

N: Is the package apt-transport-https installed?


HOW TO FIX:

cd /usr/lib/apt/methods; ln -s http https



TEST CONFIRM FIXED:

apt-get update



Saturday, January 8, 2022

How to fix missing files / packages during apt-get for Ubuntu 12.04 LTS

Are you getting these errors?

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise/main/binary-amd64/Packages  404  Not Found [IP: 91.189.88.142 80]


W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise/restricted/binary-amd64/Packages  404  Not Found [IP: 91.189.88.142 80]


W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise/universe/binary-amd64/Packages  404  Not Found [IP: 91.189.88.142 80]


W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise/main/binary-i386/Packages  404  Not Found [IP: 91.189.88.142 80]


W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.88.142 80]


W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise/universe/binary-i386/Packages  404  Not Found [IP: 91.189.88.142 80]


SOLUTION

Try changing the domain names in /etc/apt/sources.list from 

archive.ubuntu.com

security.ubuntu.com

to 

old-releases.ubuntu.com


FINAL RESULT

Example content of /etc/apt/sources.list:


deb http://old-releases.ubuntu.com/ubuntu precise main restricted universe

deb http://old-releases.ubuntu.com/ubuntu precise-updates main restricted universe

deb http://old-releases.ubuntu.com/ubuntu precise-security main restricted universe multiverse

deb http://old-releases.canonical.com/ubuntu precise partner