How to install zsh on Debian, Ubuntu or Linux Mint

Zsh is a shell designed for interactive use, although it is also a powerful scripting language.

To install Zsh on Debian, Ubuntu or Linux Mint use command:

sudo apt install zsh

Next install “Oh My Zsh” – delightful, open source, community-driven framework for managing your Zsh configuration. Use command:

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

If you want to change zsh theme go to: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

In order to enable a theme, set ZSH_THEME to the name of the theme in your ~/.zshrc

nano ~/.zshrc

Some themes need custom fonts, install it from git: https://github.com/powerline/fonts

git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh

KDE change application launcher

1. Download new application launcher from site: https://store.kde.org/browse?cat=398&ord=latest

2. Run command:

plasmapkg2 --install LauncherName.tar.gz

If you want to upgrade launcher to new version use command:

plasmapkg2 --upgrade LauncherName.tar.gz

3. Right click on Start Menu icon > Show alternatives > Select LauncherName

If you want to uninstall launcher use command:

plasmapkg2 --remove LauncherName.tar.gz

Setup Proxmox cluster

1. First download official ISO image from Proxmox website: https://www.proxmox.com/

2. Write ISO image to USB flash drive using program Etcher: https://www.balena.io/etcher/

3. Boot PC from USB drive and install Proxmox. If you have two hard drives you can use ZFS file system to create RAID array.

Now log in to Proxmox admin panel using Web-browser: https://server-ip-address:8006

After installation we need to upgrade our system. Proxmox based on Debian GNU Linus and it use Debian repositories but in free version of Proxmox we will have an error when we try to upgrade. We need to disable enterprise Proxmox repositories. Open file /etc/apt/sources.list.d/pve-enterprise.list and comment with symbol # first line with enterprise Proxmox repository.

nano /etc/apt/sources.list.d/pve-enterprise.list

Then we can update packages list and upgrade our system:

apt update
apt upgrade

After installation let’s configure Local storage.

In admin panel go to Datacenter -> Storage, select local-lvm storage and click Remove

After that go to your Node -> Shell and write next commands:

lvremove /dev/pve/data
lvresize -l +100%FREE /dev/pve/root

And the last command to resize our local storage to 100% is:

resize2fs /dev/mapper/pve-root

Done, now we can use 100% of local storage, installed in our server. If you click on local storage you can see entire size of hard drive.

To remove the “You do not have a valid subscription for this server” popup message while logging in, run the command bellow:

sed -Ezi.bak "s/(Ext.Msg.show\(\{\s+title: gettext\('No valid sub)/void\(\{ \/\/\1/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && systemctl restart pveproxy.service

Restore MySQL database from files

If you have MySQL database files and you want to restore database on new server do next steps:

1. Stop MySQL server:

systemctl stop mysql

2. Copy all files of database to /var/lib/mysql directory;

3. Also copy files:

/var/lib/mysql/ibdata1
/var/lib/mysql/ib_logfile0
/var/lib/mysql/ib_logfile1

4. Change user and group of all files in directory /var/lib/mysql to mysql:mysql:

chown -R mysql:mysql .

5. Change permission of files in directory /var/lib/mysql to 660

find . -type f -print0 | xargs -0 chmod 660

6. Start MySQL server:

systemctl start mysql

To restore database from SQL dump use command:

mysql -u [user] -p [database_name] < [filename].sql

Node.js – Lesson 5: Create Web-server application

First create file app.js:

const express = require("express");
const app = express();
const port = 8000;

app.listen(port, () => {
    console.log("Server work on "+port); 
});

In this code we require Express framework that provides a robust set of features for web and mobile applications. Define class app – our main application class and port – default server port.

We can start our server using command:

npm run start

But now our server can not do nothing, ot only write in console text: “Server work on port 8000“. Let’s create routing and say our server how to work with Url and write text to Web-browser.

First create folder “routes” and file “routes/index.js” with code:

const mainRoutes = require('./main');

module.exports = function(app) {
    mainRoutes(app);
}

Now create file “routes/main.js“:

module.exports = function(app) {
    app.get('/', (req, res) => {
        res.end('main');
    });
}

And the last – in file “app.js” require our routes – before app.listen insert this command: require(“./routes”)(app);

const express = require("express");
const app = express();
const port = 8000;

require("./routes")(app); // require /routes/index.js 

app.listen(port, () => {
    console.log("Server work on "+port); 
});

Start program in development mode:

npm run dev

Run Web-browser and open http://localhost:8000:

Similarly you can create /about, /contact or any other route on your NodeJS Web-site.

Apache Error .htaccess: RewriteEngine not allowed here

When you try to enable option RewriteEngine on in .htaccess file you can get error:

/var/www/html/.htaccess: RewriteEngine not allowed here

In this way you need to enable AllowOverride All option.

Go to /etc/apache2/sites-available and edit 000-default.conf (or other conf file of your website):

sudo nano /etc/apache2/sites-available/000-default.conf

Add next block to this file:

<Directory />
        AllowOverride All
</Directory>

Your config file will be look’s like this:

<VirtualHost *:80>
        DocumentRoot /var/www/html

        <Directory />
            AllowOverride All
        </Directory>
</VirtualHost>

Save configuration file and restart apache2

sudo systemctl restart apache2

Touchégg

Touchégg is an app that runs in the background and transform the gestures you make on your touchpad or touchscreen into visible actions in your desktop.

For example, you can swipe up with 3 fingers to maximize a window or swipe left with 4 finger to switch to the next desktop.

Many more actions and gestures are available and everything is easily configurable.

Download and install program you can on official Git repository: https://github.com/JoseExposito/touchegg