# sed -i "3s/^[^#]/#&/" /etc/openvpn/server/server.conf
公告版位
- Nov 15 Fri 2019 09:46
用sed指令去將文件第三行加上註解(#)
- Nov 08 Fri 2019 16:56
Use SSH Key for Public-Key Algorithm Ed25519
$ ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "dreamtails@pixnet.cc"
Reference: https://medium.com/risan/upgrade-your-ssh-key-to-ed25519-c6e8d60d3c54
- Aug 20 Tue 2019 13:58
Git error for connecting HTTPS: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Command:
$ git clone https://192.168.100.100/dreamtails/Dreamtails_Project.git
Error Message:
fatal: unable to access 'https://192.168.100.100/dreamtails/Dreamtails_Project.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
How to Resolve?
[For Git]
$ git config --global http.sslVerify false |
[For Linux]
$ export GIT_SSL_NO_VERIFY=1 |
[For Windows]
$ set GIT_SSL_NO_VERIFY 1 |
- Aug 19 Mon 2019 14:06
How to enable +python feature via installing VIM for Ubuntu 18.04
1. Prepare your environment.
$ sudo apt install libncurses5-dev \
libgtk2.0-dev libatk1.0-dev \
libcairo2-dev python-dev \
python3-dev git
2. Remove Old VIM.
$ sudo apt remove vim vim-runtime gvim
3. Install VIM.
$ cd /usr && sudo git clone https://github.com/vim/vim.git && cd vim
$ sudo ./configure --with-features=huge \
--enable-multibyte \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/ \
--enable-gui=gtk2 \
--enable-cscope \
--prefix=/usr/local/
$ sudo make VIMRUNTIMEDIR=/usr/local/share/vim/vim81
4. Preparing deb package using "checkinstall"
$ sudo apt install checkinstall
$ cd /usr/vim && sudo checkinstall
5. Set VIM as a default editor
$ sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1
$ sudo update-alternatives --set editor /usr/local/bin/vim
$ sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/vim 1
$ sudo update-alternatives --set vi /usr/local/bin/vim
6. Verify that you're running the new Vim binary by looking
$ vim --version | grep python
Reference: https://vi.stackexchange.com/questions/11526/how-to-enable-python-feature-in-vim
- Jul 26 Fri 2019 18:27
ElementaryOS 5.0 更改Terminal字型(Font)
1. 自己目前蠻推薦以下這個字型:
Fantasque Sans Mono - https://github.com/belluzj/fantasque-sans
2. 將您要換的字型放到以下路徑
$ mv FantasqueSansMono-*.ttf ~/.fonts/
3. 更新字型資料庫
$ fc-cache -vf ~/.fonts/
4. 安裝Gnome-Tweak-Tool
$ apt install -y gnome-tweak-tool
5. 執行Gnome-Tweak-Tool去更改字型
$ gnome-tweaks
- Jul 24 Wed 2019 12:26
How to use "PREFIX of make" and Uninstall.
1. Install Package to /usr/local
$ ./configure --prefix=/usr/local
$ make
$ sudo make install prefix=/usr/local
2. Uninstall Package
$ make clean
$ make uninstall
- Jul 19 Fri 2019 15:04
How to turn off sleep/suspend/hibernate mode on Ubuntu 16.04/18.04 from the CLI
Turn off sleep/suspend/hibernate mode from the CLI:
$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Get the sleep/suspend/hibernate status from the CLI:
$ sudo systemctl status sleep.target
$ sudo systemctl status suspend.target
$ sudo systemctl status hibernate.target
$ sudo systemctl status hybrid-sleep.target
- Jul 19 Fri 2019 12:37
ElementaryOS 5.0 or Ubuntu 18.04: Avoid nameserver 127.0.0.53 in /etc/resolv.conf
Step1)
$ sudo apt install -y resolvconf
Step2)
$ sudo vim /etc/resolvconf/resolv.conf.d/head
or
$ sudo vim /etc/resolvconf/resolv.conf.d/tail
===================================
nameserver 192.168.254.254
nameserver 10.10.10.10
nameserver 8.8.8.8
search dreamtails.local dreamtails.com
===================================
- Jul 11 Thu 2019 16:42
使用Crontab去設定GitLab定時備份與Rotation機制
使用Crontab去定時備份GitLab的資料到遠端的NFS Server (192.168.100.100:/backup/gitlab)
1. Check crond service.
# systemctl list-unit-files
2. 若crond.service是disabled,請將它enable,這樣OS啟動後才會自動執行
# systemctl enable crond.service
3. 手動啟動crond service
# systemctl start crond.service
4. 編輯crontab設定
# crontab -e
- Jul 11 Thu 2019 12:24
如何升級GitLab 8.1.3 to 12.0.3 並將資料搬到新的GitLab.
環境:
OS: CentOS 7.6
原本的GitLab IP: 1.1.1.1
新的GitLab IP: 2.2.2.2
- Jun 25 Tue 2019 18:05
vSphere ESXi 6.7 如何繞過Web UI Export OVF/OVA
解決方法:使用VMware OVF Tool 來作Export OVA File.
1. 先安裝OVF Tool (請至VMware 官方網站下載)
2. 裝完後,會有ovftool的指令,然後執行 (此為Linux下的範例)
# ovftool --noSSLVerify vi://<ESXi-ACCOUNT>@<ESXi-HOST-IP>/<VM-NAME> <OUTPUT-OVA-FILENAME>
Example:
# ovftool --noSSLVerify vi://root@192.168.1.1/DHCP-Server DHCP-Server-Template.ova
- May 28 Tue 2019 12:04
如何使用virsh指令去建立snapshot(for KVM)?
列出所有VM
$ sudo virsh list --all
建立Snapshot
$ sudo virsh snapshot-create <VM-NAME>
列出Sanpshot有哪些
$ sudo virsh snapshot-list <VM-NAME>
回復到Snapshot的狀態
$ sudo virsh snapshot-revert <VM-NAME> --snapshotname <SNAPSHOT-NAME>
- May 27 Mon 2019 18:42
How to resize QCOW2 Image from 20G to 100G?
[root@CentOS ~]# qemu-img info CentOS.qcow2
image: CentOS.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 4.0G
cluster_size: 65536
Format specific information:
compat: 0.10
[root@CentOS ~]# qemu-img resize CentOS.qcow2 +80G
Image resized.
[root@CentOS ~]# qemu-img info CentOS.qcow2
image: CentOS.qcow2
file format: qcow2
virtual size: 100G (107374182400 bytes)
disk size: 4.0G
cluster_size: 65536
Format specific information:
compat: 0.10
- May 03 Fri 2019 10:38
IP 1對1 mapping 的NAT (使用iptables) for CentOS 6
1. 在一個interface 上綁定多個IP
# vim /etc/sysconfig/network-scripts/ifcfg-eth0:0
------------------------------------------------------------
DEVICE=eth0:0
BOOTPROTO=none
IPADDR=140.140.140.1
NETMASK=255.255.255.0
ONBOOT=yes
------------------------------------------------------------
# service network restart
2. 開啟IP Forward的功能
# vim /etc/sysctl.conf
------------------------------------------------------------
......
net.ipv4.ip_forward = 1
net.ipv4.tcp_keepalive_time = 86400
......
------------------------------------------------------------
# sysctl -p
3. 加入iptables的NAT policy
# vim /etc/sysconfig/iptables
------------------------------------------------------------
......
*nat
:PREROUTING ACCEPT [417:47118]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# NAT Policy
-A POSTROUTING -s 192.168.1.1 -o eth0 -j SNAT --to-source 140.140.140.1
-A PREROUTING -d 140.140.140.1 -i eth0 -j DNAT --to-destination 192.168.1.1
COMMIT
......
------------------------------------------------------------
# service iptables restart
- Mar 22 Fri 2019 18:11
Ubuntu 18.04 重置桌面環境設、字型!
因為裝了Gnome的Dash to Dock後,覺得不是那麼的討喜,所以想還原成Ubuntu原始的桌面環境,請下以下指令:
$ dconf reset -f /
Reference: https://www.omgubuntu.co.uk/2017/10/how-to-reset-ubuntu-desktop-to-default