Skip to content

Instantly share code, notes, and snippets.

@max-lt
Last active February 22, 2021 19:46
Show Gist options
  • Save max-lt/85edbd0b64cc121f9b82200ca6f58a33 to your computer and use it in GitHub Desktop.
Save max-lt/85edbd0b64cc121f9b82200ca6f58a33 to your computer and use it in GitHub Desktop.
Archlinux quick setup for scaleway

Full system update

pacman-static

Scaleway images may not be able to upgrade due to changes in the packages format, you will need to install pacman-static (resources here and here)

cd /tmp/
curl https://pkgbuild.com/~eschwartz/repo/x86_64-extracted/pacman-static > pacman-static

chmod +x pacman-static

# Keys are probably not up to date either
./pacman-static -S archlinux-keyring

# Add lib archive so we can use pacamn
./pacman-static -S libarchive

# Full system update
pacman -Syyu

# Install bash compression
pacman -S bash-completion

Terminal format

Append the following block to the current config in /etc/bash.bashrc

# Custom configuration

## ls dir & grep colored
export LS_OPTIONS='--color=auto'
export DIR_OPTIONS='--color=auto'

## Ask to confirm
alias rm="rm -i"
alias cp="cp -i"
alias mv="mv -i"

## Username color
PS1="$(if [[ ${EUID} == 0 ]];
then echo '\[\033[01;31m\]\u\[\033[01;0m\]@\h';
else echo '\[\033[01;33m\]\u\[\033[01;0m\]@\h'; fi)\[\033[01;36m\] \w/ \[\033[01;0m\]\\$ \[\033[01;0m\]"
PS2='> '
PS3='> '
PS4='+ '

## Misc aliases
alias ls='ls -F --color=auto'
alias ll='ls -laFh --color=auto'
alias dir='dir $LS_OPTIONS'
alias grep='grep $LS_OPTIONS'
alias ssh-pass='ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no'
alias d=docker
alias dokcer=docker

## Avoid duplicates in history
export HISTCONTROL=ignoreboth:erasedups  # conserve l'historique de la precedente session
export HISTSIZE=100000                   # tres grand historique
export HISTFILESIZE=100000               # tres grand historique
shopt -s histappend                      # append to history, don't overwrite it

## Completes the current line from history (with Upwards/Downwards arrows)
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

Prepare for X11 forwarding

create X user

useradd -m x
mkdir /home/x/.ssh

# Copy your ssh key to the newly created user
cat /root/.ssh/authorized_keys | grep ssh-ed > /home/x/.ssh/authorized_keys

Edit sshd config

Ensure the following is set in /etc/ssh/sshd_config

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no

Edit sshd config

# Install xorg & some graphical programs
pacman -S xorg-xauth xorg-server xorg-xclock

systemctl restart sshd
exit

You can now use remote GUI applications

ssh -Y -C x@your-host xclock

Optimized GUI applications

pacman -S xpra firefox
xpra start  --ssh="ssh" ssh:x@your-host  --exit-with-children --start-child="firefox"

See here and here for more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment