LoginSignup
0
0

VPS(ConoHa) セットアップメモ(Ubuntu 22.04)

Last updated at Posted at 2022-11-01

最近はWebARENA Indigoに浮気していたけど、ConoHaが50万人記念(おめでとうございます)でVPS割引きっぷ75% OFFで安かった(870円/月)ので3年契約したのでセットアップをメモ

事前準備

VPS割引きっぷの購入(せっかくなのでConoHaカードで購入)とインスタンスの生成

SSH

ローカルでSSH鍵(ED25519)を作成

ssh-keygen -t ed25519 -C "..."

Webコンソールでの作業

Webコンソールへrootでログイン

apt update -y && apt upgrade -y

aptのサーバ変更

ConoHaで標準で日本サーバでした。

/etc/ssh/sshd_configの変更

Port ***
PermitRootLogin no
PasswordAuthentication no

systemctl restart sshd

ファイアウォールの設定(SSH)

ufw delete ssh
ufw allow ***

ユーザの追加

useradd -m conoha -s /bin/bash
usermod -aG sudo conoha
su conoha

作成したローカルの公開鍵を./.ssh/authroized_keysに追加

mkdir ./.ssh
chmod 700 ./.ssh
echo "ssh-ed25519 ***" >> ./.ssh/authorized_keys 

swapサイズの変更

4Gプランでは2Gが標準でしたが4Gに変更

free -m
               total        used        free      shared  buff/cache   available
Mem:            3923         594        1628          10        1700        3093
Swap:           2047           0        2047
fallocate -l 4G /swap.img
chmod 600 /swap.img
mkswap /swap.img
swapon -s
               total        used        free      shared  buff/cache   available
Mem:            3923         623         985          11        2315        3035
Swap:           4095           0        4095

SSH接続して作業

Webコンソールを閉じて、SSH接続

リモートデスクトップ環境(日本語化)

sudo apt install lxqt-core xrdp -y
sudo ufw allow 3389
sudo apt install language-pack-ja language-pack-ja-base fcitx-mozc -y
sudo localectl set-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
sudo apt purge ibus -y
sudo reboot now

Go(1.20.5)

aptでは少し古いので最新版をインストール

cd ./Downloads
sudo su
GO_VERSION=1.21.0
wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
tar -xvf go${GO_VERSION}.linux-amd64.tar.gz
rm -rf /usr/local/go
mv go /usr/local
rm go${GO_VERSION}.linux-amd64.tar.gz
exit
cd ..

echo \"
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin" >> ~/.bashrc

Git

sudo apt install git gh -y
git config --global user.name "..."
git config --global user.email "..."

Docker

sudo apt remove docker docker-engine docker.io containerd runc
sudo apt install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update -y && sudo apt upgrade -y
sudo apt install  docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

Firefox

sudo apt install firefox firefox-locale-ja -y

Visual Studio Code

deb(Stable)
https://code.visualstudio.com/docs/?dv=linux64_deb

deb(Insiders)
https://code.visualstudio.com/docs/?dv=linux64_deb&build=insiders

cd ./Downloads
sudo apt install ./code_xxx.deb

Font

Noto Sans

HackGen(白源)

cd ~/Downloads
wget https://github.com/yuru7/HackGen/releases/download/v2.7.1/HackGen_v2.7.1.zip
unzip Noto_Sans_JP.zip -d Noto
unzip Noto_Color_Emoji.zip -d Noto
unzip HackGen_v2.9.0.zip
rm Noto_Sans_JP.zip
rm unzip HackGen_v2.9.0.zip 
mkdir ~/.fonts

mv Noto_Sans_JP/*.ttf ~/.fonts/
mv HackGen_v2.9.0/*.ttf ~/.fonts/
rm Noto_Sans_JP HackGen_v2.9.0 -rf

Wine

sudo dpkg --add-architecture i386 
sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
sudo apt install --install-recommends winehq-staging -y
sudo apt install winetricks -y
winetricks

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0