概要
Ubuntu16.04をノートPCに入れたので設定や覚書を書いていく
初期設定
端末の設定
-
Ubuntuの端末内でCtrl+CやCtrl+Vを有効にしてコピーをペーする!
- コピー : Ctrl + Sheft + c
- ペースト : Ctrl + v
- 新しいターミナル : Ctrl + n
- ターミナルを閉じる : Ctrl + w
- 新しいタブ : Ctrl + t
- 次のタブ : Ctrl + Shift + n
- 前のタブ : Ctrl + Shift + b
ソフトウェアのインストール
必要なものを選んで入れる
### updateと基本的なソフトのインストール
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential wget git telnet traceroute perl patch tcpdump screen strace sysstat lsof zip unzip bzip2 sudo pv openssh-server curl vim net-tools
### エディタの設定
$ sudo update-alternatives --config editor
### ログインシェルの設定
$ sudo vi /etc/passwd
================================================
ftakao2007:x:1000:1000:ftakao2007,,,:/home/ftakao2007:/bin/bash
================================================
### pipのインストール
$ sudo sh -c "curl -kL https://bootstrap.pypa.io/get-pip.py | python"
### Ansibleのインストール
$ sudo apt-get install libssl-dev libffi-dev python-dev
$ sudo pip install ansible
### 作業用リポジトリをclone
$ git clone https://github.com/ftakao2007/work.git
### rbenvのインストール
$ cd work/build/common-app
$ ansible-playbook -i "127.0.0.1," -k -K -c paramiko rbenv.yml
$ sudo gem install rbenv-rehash bundler pry pry-doc
$ sudo gem install pry-stack_explorer pry-byebug
### pyenvのインストール
$ sudo apt-get install libssl-dev libbz2-dev libreadline-dev libsqlite3-dev
$ cd /usr/local
$ sudo git clone https://github.com/yyuu/pyenv.git
$ sudo vi /etc/profile.d/pyenv.sh
================================================
export PYENV_ROOT="/usr/local/pyenv"
export PATH="/usr/local/pyenv/bin:$PATH"
eval "$(pyenv init -)"
================================================
$ sudo visudo
================================================
...
Defaults secure_path="/usr/local/pyenv/bin:/usr/local/pyenv/shims:/usr/local/rbenv/bin:/usr/local/rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
...
Defaults env_keep += "PATH RBENV_ROOT"
Defaults env_keep += "PATH PYENV_ROOT"
================================================
$ sudo pyenv install 3.6.1
$ cd /usr/local/pyenv/plugins
$ git clone https://github.com/yyuu/pyenv-virtualenv.git
$ sudo vi /etc/profile.d/pyenv-virtualenv.sh
================================================
export PYENV_ROOT="/usr/local/pyenv"
eval "$(/usr/local/pyenv/bin/pyenv virtualenv-init -)"
================================================
### docker, docker-composeのインストール
$ cd ../dockerhost
$ vi ubuntu.yml
================================================
### ユーザ名設定
vars:
user_name: ftakao2007
================================================
$ ansible-playbook -i "127.0.0.1," -k -K -c paramiko ubuntu.yml
### aliasの設定
$ vi ~/.bashrc
================================================
alias dps="sudo docker ps -a"
alias dim="sudo docker images"
alias drm="sudo docker rm"
alias dstart="sudo docker start"
alias dstop="sudo docker stop"
dexec()
{
sudo docker exec -it $1 /bin/bash --login
}
dcpupd()
{
sudo docker-compose -f $1 up -d
}
dcpstop()
{
sudo docker-compose -f $1 stop
}
dcprmf()
{
sudo docker-compose -f $1 rm -f
}
================================================
### Javaのインストール
$ sudo apt-get install openjdk-8-jdk
### MySQLのインストール
### URLは毎回要確認
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.6-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.6-1_all.deb
$ sudo apt-get update
$ sudo apt-get install mysql-server
$ sudo apt-get install mysql-workbench-community
### LDAP管理ツール(LDAP Administration tool)のインストール
$ sudo apt-get install lat
Jupyter環境
dockerhubのイメージを利用
$ cd ../../docker/docker_compose/common-app
$ sudo docker-compose -f docker-compose_jupyter_iruby.yml up -d
$ sudo docker exec -it jupyter_iruby /bin/bash --login
$ cd /root/jupyter
$ ip=`ip a | grep -w inet | grep -v 127.0.0.1 | awk '{print $2}' | awk -F'/' '{print $1}'`
$ nohup bundle exec iruby notebook --ip=$ip &
$ cat nohup.out ### <- check password
http://(docker host ip):8888
例えば http://127.0.0.1:8888
メールの設定
- ThunderbirdでGmail設定
Rubymine設定
- WindowsやMacと同じ
Chromeインストール
ストレージサービスマウント
- GoogleDrive
- Dropbox
- box.com
ダブルクリックで実行可能ファイルを実行
- デフォルトでは中身を確認するという動作になるので変更しておく
スクリーンショット
- 全体
- PrintScreen
- 特定の領域
- Shitf + PrintScreen
仮想デスクトップ
-
Ubuntu16.04LTSのワークスペース機能を有効にする
- 全ワークスペースの表示と移動
- Windows + S
- ワークスペースの移動
- Ctrl + 矢印キー
- 全ワークスペースの表示と移動
CD
音楽を取り込む
- asunderをインストールして起動する
- lameはmp3に変換するために必要
$ sudo apt-get install asunder lame
- 設定
- 全般
- 保存先 : ミュージック
- エンコード
- MP3
- 詳細
- ディスク情報をインターネットから自動的に取得
- サーバ : freedbtest.dyndns.org
- ポート : 80
- デフォルトのfreedb.freedb.org:8880だと日本語の情報が取得できない?
- ディスク情報をインターネットから自動的に取得
- 全般
CD作成
$ sudo apt-get install brasero
iPhoneに取り込む(確認中)
$ sudo apt-get install amarok
やること
- クリップボード設定
- バーチャルデスクトップ
- エディタ設定
- LINE設定
- Slack設定
- Chrome設定
- VPN設定
- Kobo設定
トラブルシューティング
$ sudo rm /var/crash/*
$ sudo sed -i 's/enabled=1/enabled=0/g' /etc/default/apport
参考
デスクトップ環境インストール
- docker等でminimalからデスクトップ環境を構築する場合
- ユーザ名はftakao2007
### $ sudo apt-get install ubuntu-desktop
### デスクトップはlxde
$ sudo apt-get install lxde
### 日本語設定
### $ sudo apt-get install language-pack-ja-base language-pack-ja ibus-mozc fonts-ipafont
$ sudo apt-get install language-pack-ja-base language-pack-ja ibus-mozc fonts-takao-gothic
$ update-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
$ source /etc/default/locale
$ echo $LANG
================================================
ja_JP.UTF-8
================================================
### 日本の時刻設定
$ sudo dpkg-reconfigure tzdata
### tigervncserverのインストール
$ wget https://dl.bintray.com/tigervnc/stable/ubuntu-16.04LTS/amd64/tigervncserver_1.8.0-1ubuntu1_amd64.deb
$ sudo apt-get install gdebi
$ sudo gdebi tigervncserver_1.8.0-1ubuntu1_amd64.deb
$ vncserver
================================================
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:
xauth: file /home/prefuser/.Xauthority does not exist
New 'fdb816d13269:1 (prefuser)' desktop is fdb816d13269:1
Creating default startup script /home/prefuser/.vnc/xstartup
Creating default config /home/prefuser/.vnc/config
Starting applications specified in /home/prefuser/.vnc/xstartup
Log file is /home/prefuser/.vnc/fdb816d13269:1.log
================================================
$ vncserver -kill :1
================================================
Killing Xvnc process ID 5603
================================================
$ vi ~/.vnc/xstartup
================================================
;;
esac
fi
/usr/bin/ibus-daemon -d ### <- このあたりにこれを追加
/usr/bin/startlxde & ### <- このあたりにこれを追加
if [ -x /etc/X11/xinit/xinitrc ]; then
exec /etc/X11/xinit/xinitrc
fi
================================================
$ sudo vi /etc/default/vncservers
================================================
...
VNCSERVERS="2:ftakao2007"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
================================================
$ sudo vi /etc/systemd/system/vncserver@.service
================================================
# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Edit <USER> and vncserver parameters appropriately
# ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2")
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
### runuserが無くなったのでsuで実行
# ExecStart=/usr/sbin/runuser -l ftakao2007 -c "/usr/bin/vncserver %i -geometry 1280x1024"
ExecStart=/bin/su ftakao2007 -c "/usr/bin/vncserver %i -geometry 1280x1024"
PIDFile=/home/ftakao2007/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
================================================
$ sudo systemctl daemon-reload
$ sudo systemctl enable vncserver@:2.service
$ sudo systemctl start vncserver@:2.service
※ vncクライアントで「(server):5902」にアクセス
- 日本語入力設定
- 「設定」⇒「iBusの設定」⇒「General」
- Next input methodを「+space」に変更
- 「設定」⇒「iBusの設定」⇒「Input Method」
- 「英語(US)」を削除 これで「半角/全角」キーで日本語入力と英語入力を切り替えられるようになる
- 「設定」⇒「iBusの設定」⇒「General」