Docker Installation
$ sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
$ sudo apt update
$ sudo apt install -y docker-ce docker-ce-cli containerd.io
Check Docker version and status
$ docker -v
$ docker info
2020/07/15
2020/02/10
My .gitlab-ci.yml for Android Build
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "29"
ANDROID_BUILD_TOOLS: "29.0.2"
ANDROID_SDK_TOOLS: "29.0.2"
before_script:
- apt -q update
- apt -q install -y wget tar unzip lib32stdc++6 lib32z1
- wget -q -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
- unzip -q android-sdk.zip
- echo y | tools/bin/sdkmanager "tools"
- echo y | tools/bin/sdkmanager "build-tools;29.0.2"
- echo y | tools/bin/sdkmanager "platform-tools" "platforms;android-29"
- echo y | tools/bin/sdkmanager "extras;google;m2repository"
- echo y | tools/bin/sdkmanager "extras;android;m2repository"
- export ANDROID_HOME=$PWD/
- export PATH=$PATH:$PWD/
- chmod +x ./gradlew
stages:
- test
- build
unitTests:
stage: test
script:
- ./gradlew test
build:
stage: build
only:
- master
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
variables:
ANDROID_COMPILE_SDK: "29"
ANDROID_BUILD_TOOLS: "29.0.2"
ANDROID_SDK_TOOLS: "29.0.2"
before_script:
- apt -q update
- apt -q install -y wget tar unzip lib32stdc++6 lib32z1
- wget -q -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
- unzip -q android-sdk.zip
- echo y | tools/bin/sdkmanager "tools"
- echo y | tools/bin/sdkmanager "build-tools;29.0.2"
- echo y | tools/bin/sdkmanager "platform-tools" "platforms;android-29"
- echo y | tools/bin/sdkmanager "extras;google;m2repository"
- echo y | tools/bin/sdkmanager "extras;android;m2repository"
- export ANDROID_HOME=$PWD/
- export PATH=$PATH:$PWD/
- chmod +x ./gradlew
stages:
- test
- build
unitTests:
stage: test
script:
- ./gradlew test
build:
stage: build
only:
- master
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
2020/02/06
How to install Microsoft Azure CLI and Add Extension on Windows 10
1.Download azure-cli.msi and install
2.Open Windows PowerShell or Command Shell as administrator
3.Enter "az -h" to list command
4.Enter "az login
5.Enter "az extension list-available --output table" to list extension
6.Enter "az extension add --name azure-devops" to install target extension
7.Enter "az devops -h" to list command
2.Open Windows PowerShell or Command Shell as administrator
3.Enter "az -h" to list command
4.Enter "az login
-u 'username' -p 'password'
--allow-no-subscriptions" to login Microsoft Azure5.Enter "az extension list-available --output table" to list extension
6.Enter "az extension add --name azure-devops" to install target extension
7.Enter "az devops -h" to list command
2020/01/16
Docker Command Note
Copy folder to Docker Container
docker cp folder/. ContainerID:/home
Start/Stop all of Containers
docker start $(docker ps -a -q)
docker stop $(docker ps -a -q)
Removing All Unused Objects
docker system prune
docker system prune --volumes
Remove Containers
docker container ls -a
docker container stop ContainerID
docker container rm ContainerID
docker container ls -a --filter status=exited --filter status=created
docker container prune
docker container prune --filter "until=12h"
Remove Images
docker image ls
docker image rm ImageID
docker image prune
docker image prune -a
docker image prune -a --filter "until=12h"
Remove Volumes
docker volume ls
docker volume rm VolumeID
docker volume prune
Remove Networks
docker network ls
docker network rm NetworkID
docker network prune
docker network prune -a --filter "until=12h"
docker cp folder/. ContainerID:/home
Start/Stop all of Containers
docker start $(docker ps -a -q)
docker stop $(docker ps -a -q)
Removing All Unused Objects
docker system prune
docker system prune --volumes
Remove Containers
docker container ls -a
docker container stop ContainerID
docker container rm ContainerID
docker container ls -a --filter status=exited --filter status=created
docker container prune
docker container prune --filter "until=12h"
Remove Images
docker image ls
docker image rm ImageID
docker image prune
docker image prune -a
docker image prune -a --filter "until=12h"
Remove Volumes
docker volume ls
docker volume rm VolumeID
docker volume prune
Remove Networks
docker network ls
docker network rm NetworkID
docker network prune
docker network prune -a --filter "until=12h"
2020/01/10
How to add DNS address on Ubuntu 18.04
1.[user@docker:/#] sudo nano /etc/netplan/50-cloud-init.yaml
--------------------------------------------------------------------------------------------
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp0s3:
dhcp4: true
version: 2
--------------------------------------------------------------------------------------------
2.Add 2 lines as below
--------------------------------------------------------------------------------------------
network:
ethernets:
enp0s3:
dhcp4: true
nameservers:
addresses: [8.8.4.4, 8.8.8.8]
version: 2
--------------------------------------------------------------------------------------------
3.Save and exit
--------------------------------------------------------------------------------------------
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp0s3:
dhcp4: true
version: 2
--------------------------------------------------------------------------------------------
2.Add 2 lines as below
--------------------------------------------------------------------------------------------
network:
ethernets:
enp0s3:
dhcp4: true
nameservers:
addresses: [8.8.4.4, 8.8.8.8]
version: 2
--------------------------------------------------------------------------------------------
3.Save and exit
How to install Docker on Ubuntu 18.04
1.[user@docker:/#] sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
2.[user@docker:/#] sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3.[user@docker:/#] sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
4.[user@docker:/#] sudo apt update
5.[user@docker:/#] sudo apt-cache policy docker-ce
6.[user@docker:/#] sudo apt install -y docker-ce
7.[user@docker:/#] sudo systemctl status docker
8.[user@docker:/#] sudo docker -v
9.[user@docker:/#] sudo docker info
2.[user@docker:/#] sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3.[user@docker:/#] sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
4.[user@docker:/#] sudo apt update
5.[user@docker:/#] sudo apt-cache policy docker-ce
6.[user@docker:/#] sudo apt install -y docker-ce
7.[user@docker:/#] sudo systemctl status docker
8.[user@docker:/#] sudo docker -v
9.[user@docker:/#] sudo docker info
2019/10/29
How to make a Windows To Go USB disk
1.Press start menu button and type cmd to open it
2.Type "diskpart" to open disk tool
3.Type "list disk" to find your target disk
4.Type "select disk 8" to use target disk
5.Type "clean" to wipe target disk
6.Type "create partition primary" to create new partition
7.Type "format fs=ntfs quick" to quick format new partition
8.Type "assign"
9.Type "active"
10.Type "exit" to leave disk tool
11.Type "dism /apply-image /imagefile:Z:\sources\install.wim /index:1 /applydir:X:\" to install Windows in your disk
12.Type "bcdboot X:\Windows /f all /s X:\" to create bootable file in your disk
2.Type "diskpart" to open disk tool
3.Type "list disk" to find your target disk
4.Type "select disk 8" to use target disk
5.Type "clean" to wipe target disk
6.Type "create partition primary" to create new partition
7.Type "format fs=ntfs quick" to quick format new partition
8.Type "assign"
9.Type "active"
10.Type "exit" to leave disk tool
11.Type "dism /apply-image /imagefile:Z:\sources\install.wim /index:1 /applydir:X:\" to install Windows in your disk
12.Type "bcdboot X:\Windows /f all /s X:\" to create bootable file in your disk
2019/09/03
Web Browser Driver (for automation test) Download Link
Microsoft Internet Explorer 11
https://www.microsoft.com/en-us/download/details.aspx?id=44069
Mozilla Firefox
https://github.com/mozilla/geckodriver/releases
Google Chrome
https://chromedriver.chromium.org/downloads
https://www.microsoft.com/en-us/download/details.aspx?id=44069
Mozilla Firefox
https://github.com/mozilla/geckodriver/releases
Google Chrome
https://chromedriver.chromium.org/downloads
How to install Selenium by Python on CentOS 7
Installation
sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
sudo yum -y update
sudo yum -y install epel-release
sudo yum -y install python
sudo yum -y install python-pip
sudo pip install selenium
Check version
python
import selenium
print selenium.__version__
sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
sudo yum -y update
sudo yum -y install epel-release
sudo yum -y install python
sudo yum -y install python-pip
sudo pip install selenium
Check version
python
import selenium
print selenium.__version__
2019/08/28
How to open Google Chrome while remote login by SSH session on Windows 10
1.Download Xming X Server for Windows and install
2.Download putty.exe
3.Open XLaunch
4.Set display settings and click Next
2.Download putty.exe
3.Open XLaunch
4.Set display settings and click Next
How to use MRTG to generate network traffic report
1.Download ActivePerl and install
2.Download mrtg-2.17.7.zip
3.Extract mrtg-2.17.7.zip to E:\
4.Go to E:\mrtg-2.17.7\bin
5.Open cmd.exe
6.Type E: then press Enter to go E partition
7.Type cd mrtg-2.17.7\bin then press Enter to go this path
8.Type perl cfgmaker public@IP --global "WorkDir: E:\mrtg-2.17.7\bin" --output lan.cfg to create lan.cfg
9.Type perl mrtg lan.cfg to generate network traffic logs and pictures
10.Type perl indexmaker --output E:\mrtg-2.17.7\bin\lan.html --title=mrtg lan.cfg to generate summary report
2.Download mrtg-2.17.7.zip
3.Extract mrtg-2.17.7.zip to E:\
4.Go to E:\mrtg-2.17.7\bin
5.Open cmd.exe
6.Type E: then press Enter to go E partition
7.Type cd mrtg-2.17.7\bin then press Enter to go this path
8.Type perl cfgmaker public@IP --global "WorkDir: E:\mrtg-2.17.7\bin" --output lan.cfg to create lan.cfg
9.Type perl mrtg lan.cfg to generate network traffic logs and pictures
10.Type perl indexmaker --output E:\mrtg-2.17.7\bin\lan.html --title=mrtg lan.cfg to generate summary report
2019/07/31
How to enable SNMP Service on Windows 10 Build 1809
1. Open PowerShell as administrator
2. Type and execute Get-WindowsCapability -Online -Name "SNMP*" to check SNMP service didn't install
3. Type and execute Add-WindowsCapability -Online -Name "SNMP.Client~~~~0.0.1.0" to install SNMP service
4. Type and execute Get-Service -Name snmp* to check SNMP service is running now
2. Type and execute Get-WindowsCapability -Online -Name "SNMP*" to check SNMP service didn't install
3. Type and execute Add-WindowsCapability -Online -Name "SNMP.Client~~~~0.0.1.0" to install SNMP service
4. Type and execute Get-Service -Name snmp* to check SNMP service is running now
2019/07/26
How to find largest files or directories on Linux system
sudo cd /
sudo find . -type f -print0 | xargs -0 du | sort -nr | head -20 | cut -f2 | xargs -I{} du -sh {}
or
sudo find . -type d -print0 | xargs -0 du | sort -nr | head -20 | cut -f2 | xargs -I{} du -sh {}
sudo find . -type f -print0 | xargs -0 du | sort -nr | head -20 | cut -f2 | xargs -I{} du -sh {}
or
sudo find . -type d -print0 | xargs -0 du | sort -nr | head -20 | cut -f2 | xargs -I{} du -sh {}
2019/07/25
How to make VMware ESXi image with NIC driver
1.Download and install VMware PowerCLI
https://my.vmware.com/web/vmware/details?downloadGroup=PCLI650R1&productId=614
2.Download NIC drivers(.vib) for VMware ESXi
https://vibsdepot.v-front.de/wiki/index.php/List_of_currently_available_ESXi_packages
3.Download ESXi-Customizer-PS
https://www.v-front.de/p/esxi-customizer-ps.html#download
4.Set the PowerShell Execution Policy
(a)Select Start > All Programs > Windows PowerShell version > Windows PowerShell
(b)Type "Set-ExecutionPolicy RemoteSigned" and run for Remote Signed
(c)Type "Set-ExecutionPolicy Unrestricted" and run for Unrestricted
5.Execute ESXi-Customizer-PS-v2.6.0.ps1 to make a VMeware ESXi 6.7 customized iso file
(a)Open VMware PowerCLI
(b)Type .\ESXi-Customizer-PS-v2.6.0.ps1 -v67 -vft -load net-e1000e,net55-r8168 -pkgDir 'E:\VMwareESXi\NIC_Driver_ESXi' -outDir 'E:\VMwareESXi\customized_iso' and run
(c)Go to E:\VMwareESXi\customized_iso path and you'll find the ESXi-6.7.0-20190604001-standard-customized.iso file
https://my.vmware.com/web/vmware/details?downloadGroup=PCLI650R1&productId=614
2.Download NIC drivers(.vib) for VMware ESXi
https://vibsdepot.v-front.de/wiki/index.php/List_of_currently_available_ESXi_packages
3.Download ESXi-Customizer-PS
https://www.v-front.de/p/esxi-customizer-ps.html#download
4.Set the PowerShell Execution Policy
(a)Select Start > All Programs > Windows PowerShell version > Windows PowerShell
(b)Type "Set-ExecutionPolicy RemoteSigned" and run for Remote Signed
(c)Type "Set-ExecutionPolicy Unrestricted" and run for Unrestricted
5.Execute ESXi-Customizer-PS-v2.6.0.ps1 to make a VMeware ESXi 6.7 customized iso file
(a)Open VMware PowerCLI
(b)Type .\ESXi-Customizer-PS-v2.6.0.ps1 -v67 -vft -load net-e1000e,net55-r8168 -pkgDir 'E:\VMwareESXi\NIC_Driver_ESXi' -outDir 'E:\VMwareESXi\customized_iso' and run
(c)Go to E:\VMwareESXi\customized_iso path and you'll find the ESXi-6.7.0-20190604001-standard-customized.iso file
2019/06/26
How to generate date and time log in Windows batch script
for /f "skip=1 delims=" %%z in ('wmic os get localdatetime') do if not defined Z set Z=%%z
set DATE=%Z:~0,4%-%Z:~4,2%-%Z:~6,2%
set TIME=%Z:~8,2%-%Z:~10,2%-%Z:~12,2%
set timestamp=%DATE%_%TIME%.log
or
set timestamp=%DATE:/=-%@%TIME::=-%
set timestamp=%timestamp: =%
set timestamp=%timestamp:,=.%.log
or
set timestamp=%date:~0,4%%date:~5,2%%date:~8,2%@%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2%
set timestamp=%timestamp:,=.%.log
2019/06/14
How to install SonarQube 7.x on Ubuntu 18.04
Install required package
apt update && sudo apt upgrade -y
apt install -y unzip curl openjdk-8-jdk-headless mysql-server
Create Database
mysql -uroot -p
CREATE DATABASE sonarqube;
CREATE USER sonarqube@'localhost' IDENTIFIED BY 'sonarqube';
GRANT ALL ON sonarqube.* to sonarqube@'localhost';
FLUSH PRIVILEGES;
\q
apt update && sudo apt upgrade -y
apt install -y unzip curl openjdk-8-jdk-headless mysql-server
Create Database
mysql -uroot -p
CREATE DATABASE sonarqube;
CREATE USER sonarqube@'localhost' IDENTIFIED BY 'sonarqube';
GRANT ALL ON sonarqube.* to sonarqube@'localhost';
FLUSH PRIVILEGES;
\q
2019/05/20
How to install Matomo on Ubuntu 18.04
apt update && sudo apt upgrade -y
apt install -y curl wget git unzip
MySQL Installation
apt install -y mysql-server
mysql_secure_installation
Would you like to setup VALIDATE PASSWORD plugin? N
New password: your_secure_password
Re-enter new password: your_secure_password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
mysql -u root -p
mysql> CREATE DATABASE dbname;
mysql> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> exit
apt install -y curl wget git unzip
MySQL Installation
apt install -y mysql-server
mysql_secure_installation
Would you like to setup VALIDATE PASSWORD plugin? N
New password: your_secure_password
Re-enter new password: your_secure_password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
mysql -u root -p
mysql> CREATE DATABASE dbname;
mysql> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> exit
2019/02/15
My Grub2 boot menu for Ubuntu USB bootable drive (compatible with macOS machine)
insmod png
set timeout=9
if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
if background_image /Tokyo.png ; then
set color_normal=white/black
set menu_color_normal=white/black
set menu_color_highlight=yellow/black
else
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
fi
set timeout=9
if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
if background_image /Tokyo.png ; then
set color_normal=white/black
set menu_color_normal=white/black
set menu_color_highlight=yellow/black
else
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
fi
2018/10/08
How to install Gitlab 11 on Ubuntu 18.04
apt update
apt install -y curl openssh-server ca-certificates postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
apt install gitlab-ce
Open browser and type http://localhost to open web page
Change your root password and login
enjoy~
apt install -y curl openssh-server ca-certificates postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
apt install gitlab-ce
Open browser and type http://localhost to open web page
Change your root password and login
enjoy~
2018/07/29
My Grub2 Menu Config
insmod png
insmod part_msdos
insmod fat
insmod ntfs
insmod ext2
set root='hd0,msdos1'
set timeout=10
if loadfont /boot/grub/fonts/unicode.pf2 ; then
set gfxmode=1024x768
insmod efi_gop
insmod efi_uga
insmod vbe
insmod vga
insmod gfxterm
terminal_output gfxterm
fi
if background_image /boot/grub/sakura.png ; then
set color_normal=light-gray/black
set menu_color_normal=black/black
set menu_color_highlight=green/dark-gray
else
set color_normal=white/black
set menu_color_normal=white/black
set menu_color_highlight=green/dark-gray
fi
insmod part_msdos
insmod fat
insmod ntfs
insmod ext2
set root='hd0,msdos1'
set timeout=10
if loadfont /boot/grub/fonts/unicode.pf2 ; then
set gfxmode=1024x768
insmod efi_gop
insmod efi_uga
insmod vbe
insmod vga
insmod gfxterm
terminal_output gfxterm
fi
if background_image /boot/grub/sakura.png ; then
set color_normal=light-gray/black
set menu_color_normal=black/black
set menu_color_highlight=green/dark-gray
else
set color_normal=white/black
set menu_color_normal=white/black
set menu_color_highlight=green/dark-gray
fi
訂閱:
文章 (Atom)