Skip to content

Latest commit

 

History

History
executable file
·
1190 lines (834 loc) · 24.9 KB

Manjaro_Note.md

File metadata and controls

executable file
·
1190 lines (834 loc) · 24.9 KB

[TOC]

Check version

cat /etc/lsb-release

Turn off Windows 10 fast boot

In control pannel, power management.

pacman

Mirrors

Mirrors can be managed using pacman-mirrors command, with official illustration here.

Manjaro mirror list can be obtained from web

Update all mirror

  1. One can get the newest mirror from net, then insert into /etc/pacman.d/mirrorlist.

  2. One can use the following command to auto update mirrors:

    sudo pacman-mirrors -c all

Change Chinese Mirror

  1. Configure Chinese mirror:

    sudo pacman-mirrors -i -c China -m rank
  2. Choose "tsinghua" mirror in poped out window:

  3. Open /etc/pacman.conf:

    sudo code /etc/pacman.conf
  4. At the end, type in:

    [archlinuxcn]
    SigLevel = TrustAll //remove after install archlinuxcn-keyring
    Server = http://repo.archlinuxcn.org/$arch
  5. Update package list:

    sudo pacman -Syy
  6. Sync package and updates:

    sudo pacman -Syu

Install archlinuxcn-keyring

sudo pacman -S archlinuxcn-keyring

command

List installed files for specific package

pacman -Q -l <pkg name>

List dependency of a package

pactree <pkg name>

Remove all downloaded packages

pacman -Sc

AUR

Enable

  1. Open pamac-manager
    pamac-manager
  2. Select [首选项] from top right corner
  3. Select [AUR] tab, tick the enable option

Downgrade AUR package

  1. Goto AUR page for the package:
  2. Click View Changes
  3. Pick target published version:
  4. Click download:
  5. Unzip the downloaded file
  6. CD into the unzipped directory, run makepkg -si

NordVPN

Using openvpn(installed already):

Change DNS to NordVPN DNS

  1. Open /etc/resolv.conf :

    sudo code /etc/resolv.conf
  2. Remove everything and type in the following and save:

    nameserver 103.86.96.100
    nameserver 103.86.99.100
    

Connecting

  1. Connecting using openvpn using one of the configuration file from ls ./OpenVPN/:

    sudo openvpn --config ./OpenVPN/us7097.nordvpn.com.udp.ovpn
  2. Type in account info:

    Username: 
    Password: 

Change back to normal DNS

Open /etc/resolv.conf , remove everything and type in :

# Generated by NetworkManager
nameserver 192.168.0.1

Strongswan servers

172.104.106.200 - jp598.nordvpn.com
139.162.111.224 - jp599.nordvpn.com
139.162.118.94 - jp599.nordvpn.com
45.79.111.177 - us5783.nordvpn.com
45.79.111.208 - us5784.nordvpn.com
45.79.64.4 - us5784.nordvpn.com
45.79.64.48 - us5783.nordvpn.com
178.79.134.237 - uk2326.nordvpn.com
109.74.193.212 - uk2326.nordvpn.com
176.58.98.210 - uk2326.nordvpn.com

Chromium keyring

After insalling archlinuxcn-keyring each time open chromium first time will asking for password:

The following are steps to disable this:

  1. Install seahorse:
       sudo pacman -S seahorse
  2. Open seahorse and mouse-right "默认秘钥环" and choose "更改密码":
  3. Type in old pass word, and input nothing in the new password setting.
  4. Press OK for non password setting, and reboot.

VS-Code

font

  1. Install ttf-droid fonts package from AUR
  2. Reboot

Remote development

  1. To enable specific function on remote, need to install AUR's official VS-Cdoe package visual-studio-code-bin
  2. Install Docker extension.
  3. Install Remote Development vscode extension package

Mouse Cursor size

VS-Code mouse cursor size will be different with the system one shows as follow:

To fix this, do as follow:

  1. Open ~/.profile:
    code ~/.profile
  2. At the end of the file, type in:
    export XCURSOR_SIZE=16

Title bar

Go to Settings and search Title Bar Style, select custom.

Status bar

Snip tool

Using screenshooter, in terminal:

screenshooter

For screen shoot need operations, using delay time setting.

GitHub

Pre-installation

Install git, openssh and libssh

Config git

Configure git user name and email by following:

git config --global user.name "shore"
git config --global user.email "[email protected]"

Remote

  1. Create repository in GitHub
  2. Record SSH address
  3. Initialize local git repository
    git init
  4. Add remote
    git remote add <remote-name> <ssh-address>

Create SSH

Type in:

ssh-keygen -t rsa -C "[email protected]"

Input the destination for genarated SSH key:

Enter file in which to save the key (/home/shore/.ssh/id_rsa): /home/shore/tt.txt

For passphrase, using defualt by not typing anything and press Enter for 3 times.

Output would be 2 files: tt.txt for private key and tt.txt.pub for public key.

Adding new SSH-key in GitHub

Login GitHub and navigate to personal settings. Click on SSH and GPG keys tab and press New SSH key

Copy content of tt.txt.pub and press Add SSH key:

Clong Repository

Create new repository or find url for existting one under the account, using git clone to clone the repository:

git clone https://github.com/Shoreshen/Hello.git

Commit and upload

Commit changings by:

git add -A
git commit -m "message for commit"

Push to GitHub by:

git push origin master

Then type in usename and password.

Establish remote connection

git remote add origin https://github.com/Shoreshen/Hello.git

Ignore

To ignore files under git workspace, create ignore file:

touch ./.gitignore

Add entries to ignore:

.vscode-ctags #specific file

/edk2/ #Ignore all files under directory ./edk2

To remove already tracked file, need to reset cache

git rm -r --cached .
git add .
git commit -m"update .gitignore"

Submoduel

If there exists submodule, git will not automatically clone them.

To clone all submodules using the following command:

git submodule update --init --recursive

To add submodule using

git submodule add <URL> <PATH>

To remove submodule:

  1. Remove relative entries in ./.gitmodules
  2. Stage change git add .gitmodules
  3. Remove relative entries in .git/config
  4. Run git rm --cached <path/to/submodule>
  5. Remove file rm -rf .git/modules/<path/to/submodule>
  6. Commit all changes git commit -m "Removed submodule"
  7. Delete the now untracked submodule files rm -rf <path/to/submodule>

Command

submodual

Documentation in this link.

To first time recursively (including submoduals of submodual) download submoduals:

git submodule update --init --recursive

To set defualt submodule branch:

git submodule set-branch --branch <branch name> <submodule path>

To execute command for each submodual recursively:

git submodule foreach --recursive '<git command>'

The following command pull the submodules to the latest commit of parent reporsitoy. Not the latest commit of submodule repositories.

git pull --recurse-submodules=yes origin master

e.g.: For commit A_1 of rep A, submodule B is at B_1. If rep B has newer commit B_2 and rep A remains, the command will only pull A_1 for rep A and B_1 for rep B.4 Which is the same commit as of A to submodule B.

Compare

Documentation in this link.

Disable scroll and diff session:

git config --global core.page cat

List all commit IDs:

git log

Compare same file in different commits:

git diff <CommitID> <CommitID> <Path/to/File>

Output to file:

git diff --output=<Path/to/log> <CommitID> <CommitID> <Path/to/File>

Terminal

Terminal font

In terminal, select "Edit->Preference->Appearance", select "Source Code Pro Light" font.

find instruction

Gramma as follow:

find <dir> -name <file name>

file name can use "*" or "%" to represent uncertain characters.

Onedrive

Install Rclone

sudo pacman -S rclone

Config Rclone

Start configure by:

rclone config

Pop out the following options:

$ rclone config
Current remotes:

Name                 Type
====                 ====
mega                 mega

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q>

Choose n for creating new remote.

Type in the name would like to call the remote:

name> onedrive

Select the number with illustration of "Microsoft OneDrive":

...
19 / Microsoft OneDrive
   \ "onedrive"
...
Storage> 19

Next two steps, press Enter without entering any information since there's no need to enter the Microsoft App Client ID or Secret:

Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> 
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> 

Enter "n" for advanced config:

Edit advanced config? (y/n)
y) Yes
n) No
y/n> n

Type "y" for auto configuration:

Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> y

A new tab should open in your default web browser, asking you to give Rclone access to your OneDrive account. Allow it and you can close the tab.

Rclone runs a webserver on your local machine (on port 53682) to retrieve the authentication token. You may need to unblock it temporarily if you use a firewall.

Type in "1" to choose "OneDrive Personal or Business" account:

Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Type in driveID
   \ "driveid"
 4 / Type in SiteID
   \ "siteid"
 5 / Search a Sharepoint site
   \ "search"
Your choice> 1

Type "0" to choose the only existing account:wen

Found 1 drives, please select the one you want to use:
0:  (personal) id=f119f51f0a00000
Chose drive to use:> 0

Enter "y" to confirm url and "y" to confirm configuration setting:

Found drive 'root' of type 'personal', URL: https://onedrive.live.com/?cid=0f119f51f000000
Is that okay?
y) Yes
n) No
y/n> y
[onedrive]
type = onedrive
token = {"access_token":"GoKSt5YMioiuCWX1KOuo8QT0Fwy+Y6ZeX7M","token_type":"bearer","refresh_token":"7OMvoEAO3l*8BbhS2AMxpTbJW0Y6np9cdql!bwEdYAhJ6XBG0tnR0UK","expiry":"2018-07-26T15:15:13.696368366+03:00"}
drive_id = f119f51f0a00000
drive_type = personal
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y

Lastly enter "q" to quit configuration.

Rclone sync

To copy files from or to onedrive, use rclone sync command:

rclone sync onedrive:OSFiles ~/OneDrive/OSFiles

To push the local change into onedrive:

rclone sync ~/OneDrive/manjaro_note onedrive:manjaro_note
  1. onedrive:OSFiles: Configured remote address: onedrive: The remote name selected during configuration. OSFiles: The sub-directory :: Indicating it is a remote directory
  2. ~/OneDrive/OSFiles: Local directory

Rclone mount

Mount onedrive to local file directory:

rclone --vfs-cache-mode full mount onedrive: ~/OneDrive

Install Fcitx (Chinese input method)

sudo pacman -S fcitx-lilydjwg-git fcitx-configtool fcitx-sogoupinyin

Emacs

Install

From pacman:

pacman -S emacs

Enable Sogou(fcitx)

  1. Open ~/.profile:
    code ~/.profile
  2. At the end of the file, type in:
    export GTK_IM_MODULE=fcitx
    export QT_IM_MODULE=fcitx
    export XMODIFIERS=@im=fcitx
    export LC_CTYPE=zh_CN.UTF-8

Cursor size

  1. Open ~/.profile:
    code ~/.profile
  2. At the end of the file, type in:
    export XCURSOR_SIZE=16
  3. open ~/.bash_profile
  4. At the end of the file, type in:
    [[ -f ~/.bashrc ]] && . ~/.profile

Latex

Install texlive by:

pacman -S texlive-core texlive-langchinese

Themes

Press M-x and type in load-theme and use Up or Down to select themes.

Current theme: tango-dark.

Presettings

Latex function size

  1. Press M-x and type in customize variable
  2. Type in org format latex options with Enter
  3. Find key scale adjust corresponding value to 1.5
  4. Press Apply and Save button

Packages

List

Press M-x and type in list-package to list the available pakcages.

Add "Melpa" archive

To import melpa pakcages archive, follow the following steps:

  1. Press M-x and type in customize variable
  2. Type in package archives with Enter
  3. Press INS to add new achive with name "melpa" and URL "http://melpa.org/packages/"
  4. Press Apply and Save button

This will not only add new source, also create .emacs configuration file.

Install packages

To refresh melpa archive package list, need to connect to VPN

List packages, select the ones that need to be installes.

Current needed packages:

neotree            20181121.2026 installed             A tree plugin like NerdTree for Vim
org-bullets        20190802.927  installed             Show bullets in org-mode as UTF-8 characters

neotree

Neotree window not resizable by default. need to add (setq neo-window-fixed-size nil) in .emacs file

.emacs

New installed Emacs do not have presetting file.

Create .emacs file under ~/ directory or manually customize variable will also auto-create .emacs file.

The following is the current settings:

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(desktop-save t)
 '(desktop-save-mode t)
 '(org-format-latex-options
   (quote
    (:foreground default :background default :scale 0.8 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
		 ("begin" "$1" "$" "$$" "\\(" "\\["))))
 '(org-startup-indented t)
 '(package-archives
   (quote
    (("gnu" . "https://elpa.gnu.org/packages/")
     ("melpa" . "http://melpa.org/packages/"))))
 '(package-selected-packages (quote (org-bullets neotree))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

;;Org bullets activation
(require 'org-bullets)
(add-hook 'org-mode-hook 'org-bullets-mode)
;;NeoTree activation
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)
(neotree-dir "/home/shore/OneDrive")
(setq neo-window-fixed-size nil)
;;Org-mouse activation, expand on click of section
(require 'org-mouse)
;;Disable Ctrl+Space for switching input method
(global-set-key (kbd "C-SPC") nil)

Download

Use qbittorrent

sudo pacman -S qbittorrent

Graphic

Install Nvidia Drive

Select proper drive from here.

Install from "manjaro-settings-manager":

manjaro-settings-manager

And pick select the correct drive:

Or use the following command:

sudo mhwd -i pci video-nvidia-440xx

Preventing GPU falling off the bus

Need to set performance mode of GPU, which can be done by:

/usr/bin/nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=1"

To avoid operating every boot, add this into the bootup option:

Configuration

From here select the correct link for drive. What installede here is nvidia-prime.

Follow the instruction and reboot.

Dual screen

Configuration

  1. Install "xrandr"
    sudo pacman -S lxrandr
  2. Plug in HDMI/DP or other port, if screen displays, retrive device name by:
    xrandr -q
  3. Configure as second screen when connected:
    xrandr --output HDMI-0 --auto --right-of DP-2

Save setting

Connect the second screen and start up nvidia-settings:

sudo nvidia-settings

Select "X Server Display Configuration", pick the second screen and press "Save to X Configuration File":

Softwares

Octave

Install by:

sudo pacman -S octave

Wangyi yun music

Install by:

sudo pacman -S netease-cloud-music

Calculator

Install by:

sudo pacman -S gnome-calculator

Pdf viewer

Install by:

sudo pacman -S evince

Hex viwer

Install by:

sudo pacman -S ghex

Sunloginclient(向日葵)

Search sunloginclient from AUR subsidiary and build.

Need to enable remote control and start sunlogin service each reboot:

xhost + && echo $(PW) | sudo -S systemctl start runsunloginclient

Start sunloginclient.

PostgreSQL

Installatiion

From pacman:

sudo pacman -S postgresql

Initialization DB

Database need to be initialized:

sudo -iu postgres
initdb -D /var/lib/postgres/data

Start postgres service

sudo systemctl enable postgresql.service # Start service at boot
sudo systemctl start postgresql.service # Start service now

Upgrade

Once major version is updated, the data created will not be compatible.

To migrate the existing data, should apply step in here.

Major steps are listed follow:

  1. Stop postgresql service:
    systemctl stop postgresql.service
    systemctl status postgresql.service #Make sure service were stopped
  2. Upgrade postgresql and install upgrading package
    sudo pacman -S postgresql postgresql-libs postgresql-old-upgrade
  3. Copy & create relative directorys and change owner
    sudo mv /var/lib/postgres/data /var/lib/postgres/olddata
    sudo mkdir /var/lib/postgres/data /var/lib/postgres/tmp
    sudo chown postgres:postgres /var/lib/postgres/data /var/lib/postgres/tmp
    cd /var/lib/postgres/tmp
  4. Switch user and initilize new database for current postgresql
    sudo -iu postgres
    initdb -D /var/lib/postgres/data
  5. Using "pg_upgrade" to migrate the old data, PG_VERSION refers to the old version, should be same as indicated from postgresql-old-upgrade package:
    pg_upgrade -b /opt/pgsql-PG_VERSION/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data
  6. Clean old data, start service, re-analyze optimizor and switch back user
    sudo ./delete_old_cluster.sh
    systemctl start postgresql.service
    systemctl status postgresql.service
    ./analyze_new_cluster.sh
    su shore

pulse-secure

Install from AUR package:

sudo pamac install pulse-secure

Enable/start service

sudo systemctl enable pulsesecure.service
sudo systemctl start pulsesecure.service

Need reboot to take effect.

UniVPN

Download the linux version from leagsoft at this link

Unzip it and find file univpn-linux-64-XXXXX.X.X.XXXX.run and replace the line ARCH="`arch`" with ARCH="`uname -m`" (use a hex editor, normal editor will disable the file)

Change the atrribute and run the file

chmod 755 univpn-linux-64-10781.9.0.1229.run
sudo ./univpn-linux-64-10781.9.0.1229.run

Time

Open Manjaro-Settings-Manager, double click 时间和日期. Make sure settings are as following:

Teamviewer

Install teamviewer

sudo pacman -S teamviewer

Run the following command:

sudo teamviewer --daemon enable

Install pip

  1. Download installation file:
    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  2. Run installation file:
    python get-pip.py

Viewing system log

Install QJournalctl

sudo pacman -S QJournalctl

Docker

Install

Install docker by:

sudo pacman -S docker

Start docker service by:

sudo systemctl start docker

Check information (after start docker service):

sudo docker info

Add docker to no-root user

sudo groupadd docker
sudo usermod -aG docker $USER

login quay.io

docker login -u="shoreshen" -p="password generated on web" quay.io

To generate a new cli password, goto this web and login

Command

View running containors:

docker ps

View all containors:

docker ps -a

List all images:

docker images

Remove image:

docker rmi <IMAGE ID>

Stop running containor:

docker stop <CONTAINER ID>

Stop all running containors:

docker rm $(docker ps -a -q)

Commit containor into image:

docker commit <CONTAINER ID> <Image Name>

Download manylinux1 image:

docker pull quay.io/pypa/manylinux1_x86_64:latest

Running docker image into terminal:

docker run -it --rm -e PLAT=manylinux1_x86_64 -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /bin/bash

Running docker image on background:

docker run -itd --user "$$(id -u):$$(id -g)" -e PLAT=manylinux1_x86_64 -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /bin/bash
Option Illustration
-it Creating an interactive bash shell in the container
--rm Automatically remove the container when it exits
-v `pwd`:/io Map current host directory into Docker directory:/io/
quay.io/pypa/manylinux1_x86_64 Docker image name
/bin/bash Run into bash, allow terminal conversation
PLAT=manylinux1_x86_64 Define $PLAT variable
--user "UID:GID" run command with user id as "UID" and group id as "GID"

Exit running docker image in terminal:

[root@68fbe0dda3ea /]# exit
exit

Example on compile manylinux pandas

  1. Download pandas 0.24.2 source code here.

  2. Run docker manylinux_x86_84 image

docker run -it --rm -e PLAT=manylinux1_x86_64 -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /bin/bash
  1. Move file and unzip
cp /io/pandas-0.24.2.tar.gz /home/
cd home
tar -zxvf pandas-0.24.2.tar.gz
  1. Use narrow-unicode python 2.7.x to create wheel
cd pandas-0.24.2
/opt/python/cp27-cp27m/bin/python setup.py bdist_wheel
  1. Repair the wheel file and output to host directory
auditwheel repair dist/pandas-0.24.2-cp27-cp27m-linux_x86_64.whl --plat manylinux1_x86_64 -w /io/

Stop system beep

su
echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf