Zobrazujú sa príspevky s označením Ubuntu. Zobraziť všetky príspevky
Zobrazujú sa príspevky s označením Ubuntu. Zobraziť všetky príspevky

piatok 27. decembra 2019

How to setup NextCloud (NC) client on Ubuntu

This howto inspired by this article was tested on Ubuntu 16.04 LTS, but should also work on 18.04 LTS and other non-LTS versions.

Installation and startup of NC desktop sync client

sudo add-apt-repository ppa:nextcloud-devs/client
sudo apt update
sudo apt install nextcloud-client

mkdir ~/nextcloud.user@nextcloud.service # sync folder creation
nextcloud # setup authentication and choose created sync folder

Change sync folder icon

It can be useful for user to know, that NC sync folder is "special". We can do it by setting custom folder icon via folder properties in Nautilus. E.g. this icon can be used: /usr/share/icons/Humanity/places/48/folder-remote.svg.

Migrate Ubuntu/Unity/GNOME known folders to NC

mv ~/{Desktop,Documents,Downloads,Music,Pictures,Public,Templates,Videos} ~/nextcloud.user@nextcloud.service
ln -s ~/nextcloud.user@nextcloud.service/{Desktop,Documents,Downloads,Music,Pictures,Public,Templates,Videos} ~

After migration, symlinks to known folders in home directory preserve their icons, but not in NC sync folder, so they can be also changed as above, to correspond with their original locations.

How to upgrade Google Chrome on Ubuntu

Tested on Ubuntu 16.04 LTS (and should work also on 18.04 LTS and other non-LTS versions):

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# on 32-bit system remove [arch=amd64] from:
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get upgrade google-chrome-stable

Inspired by this article.


streda 6. novembra 2019

Speeding up filesystem search indexing in WSL by keeping unnecessary drives unmounted

The Problem

Indexing search for locate was very slow, sometimes maybe infinetely. Idexing was starting up by sudo updatedb, but not finishing.

The Hypothesis

As seen via mount command in WSL, there were mounted several drives slowing down indexing search for locate:
  • C: (default system drive of Windows host) - needed sometimes
  • G: (drive from Google Drive File Stream) - however, not working correctly
  • multiple (?) N: drives (resulted from these last month experiments) - not needed already
I wanted to unmount and keep them unmounted.

The Solution

The /etc/wsl.conf was not existing initially in WSL (ls -al /etc/wsl.conf), so created it this way

sudo bash -c "echo [automount] >> /etc/wsl.conf"
sudo bash -c "echo enabled=false >> /etc/wsl.conf"

Restart WSL instance via Windows command-prompt (cmd.exe):

wsl --list --running
wsl --terminate "Ubuntu-18.04"ubuntu1804

Now we see in WSL via mount, that those Windows drives in WSL are not mounted, and sudo updatedb is remarkably faster.

Drives can be mounted and unmounted on demand - example:

sudo mount -t drvfs C: /mnt/c
sudo umount /mnt/c

More information about wsl.conf: https://devblogs.microsoft.com/commandline/automatically-configuring-wsl/.

utorok 8. októbra 2019

Windows Subsystem for Linux (WSL) + Google Drive mount

Motivation

There was a need to access files mounted to Windows 10 machine via Google Drive File Stream (GDFS, as G: drive) from WSL, to be able to work with them on the same machine with Linux tools like vim, bash, etc., not to be dependent on separate Linux machine, nor inefficiently installing those tools in Windows (some could work, some not without problems or at all), nor copy them after modifications from local to GDFS locations other way (manually).

Components

Solution consists of:
  • Windows 10 OS
  • drive G: mounted by Google Drive File Stream
  • OpenSSH server for Windows (running as Windows 10 service)
  • SFTP Net Drive
  • Windows Subsystem for Linux (WSL)
Tools used during implementation:
  • Windows PowerShell
  • WSL Bash

Hacks honorable to be mentioned

Steps

  1. install Ubuntu 18.04 LTS based WSL in Windows
  2. install Google Drive File Stream and connect to the service (mount as e.g. G:)
  3. install OpenSSH Server for Windows - optional feature (Settings > Apps > Manage optional features > Add a feature > OpenSSH Server > Install
  4. via Services management enable, set to start automatically & start OpenSSH Authentication Client and then via administrative PowerShell:
    • Start-Service ssh-agent
    • Start-Service sshd
    • Install-Module -Force OpenSSHUtils
  5. comment AuthorizedKeysFile in C:\ProgramData\ssh\sshd_config
  6. non-administrative PowerShell:
  7. (troubleshoot if needed) and restart OpenSSH Server
  8. download SFTP Net Drive and install it (+ register to start on OS startup), connect with authorized username to localhost (mount as e.g. N:), there are these alternatives:

  9. set installed program to start automatically after log-on (click on program in start menu, open file location, Windows+R: shell:startup, create shortcut of the program there)
  10. make directory symlink (if using SFTP Net Drive Free) or directory junction (if using SFTP Net Drive V2 or Full) on Windows from mounted user profile to G: - now G: can be accessed also from WSL as /mnt/n, but after mount in WSL:
  11. from cmd.exe: ubuntu
  12. mount N: from WSL: sudo mkdir /mnt/n; sudo mount -t drvfs N: /mnt/n

Further hacks

There were problems with perpetually changing inodes of files trying to write modifications by vim, therefore this workaround is currently in place:

cat ~/.vimrc

set nobackup
set backupcopy=yes
set noswapfile
set noundofile
set nowritebackup

Automatic mount of N: in WSL with owner's privileges:

tail -n 10 ~/.profile

if [ ! -d "/mnt/n/" ]; then
        sudo mkdir /mnt/n
fi

sudo mount -t drvfs -o uid=1001,gid=1001 N: /mnt/n

# mount some folder
if [ ! -d "SYMLINKED_FOLDER_NAME" ]; then
        rm -f SYMLINKED_FOLDER_NAME
        ln -s /mnt/n/GDrive/... SYMLINKED_FOLDER_NAME
fi

Requires user to be in admin or sudo group in /etc/group and this settings in /etc/sudoers (via visudo in WSL) - not very secure setup, but WSL is not "mission critical server" :) :

sudo cat /etc/sudoers

# Members of the admin group may gain root privileges
%admin ALL=(ALL) NOPASSWD: ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) NOPASSWD: ALL

Conclusion

The purpose of this article is me to be able re-run these steps on another computers or user profiles and can be continually improved in the future, to be more exact.