Skip to content

Instantly share code, notes, and snippets.

@MOOOWOOO
Last active May 6, 2023 15:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MOOOWOOO/2c0578767342d4009c7c53fde365bef0 to your computer and use it in GitHub Desktop.
Save MOOOWOOO/2c0578767342d4009c7c53fde365bef0 to your computer and use it in GitHub Desktop.
Init a virtual machine
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
setopt no_nomatch
export TERM="xterm-256color"
ZSH_TIME='24'
eval "$(thefuck --alias fuck)"
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias ezsh='vim ~/.zshrc'
alias szsh='source ~/.zshrc'
alias chongqi='sudo reboot'
alias guanji='sudo shutdown -h now'
alias -s gz='tar -xzvf'
alias -s tgz='tar -xzvf'
alias -s zip='unzip'
alias -s bz2='tar -xjvf'
# Path to your oh-my-zsh installation.
export ZSH="/root/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="ys"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git z zsh-autosuggestions zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
/etc/pip.conf
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
/etc/apt/sources.list
deb http://mirrors.aliyun.com/raspbian/raspbian/ buster main contrib non-free rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ buster main contrib non-free rpi
/etc/apt/sources.list.d/raspi.list
deb http://mirrors.aliyun.com/raspbian/raspbian/ buster main
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ buster main
/etc/shadowsocks.json
{
"server": "yourip",
"server_port": yourport,
"local_address": "127.0.0.1",
"local_port": 1080,
"password": "yourport",
"timeout": 300,
"method": "chacha20-ietf-poly1305",
"fast_open": true,
}
sudo apt update && sudo apt upgrade --fix-missing -y
sudo apt install -y vim tmux zsh python3-dev python3-pip git git-flow xz-utils nginx mysql
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
chsh -s /bin/zsh
pip3 install -U pip setuptools thefuck
vim ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
ssh-keygen
vim ~/.ssh/id_rsa.pub
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
NODE_PATH=~/=.nvm/versions/node/v13.5.0/lib/node_modules
export NODE_PATH
nvm ls-remote
nvm install v13.5.0
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt remove cmdtest
sudo apt autoremove
sudo apt update
sudo apt install --no-install-recommends yarn
## taobao yuan
npm config set registry https://registry.npm.taobao.org
yarn config set registry https://registry.npm.taobao.org
## tencent yuan
npm config set registry http://mirrors.cloud.tencent.com/npm/
yarn config set registry http://mirrors.cloud.tencent.com/npm/
yarn global add pm2
yarn install
pm2 startOrReload pm2.json
sudo ln -s /home/ubuntu/firekylin/fk_blog.conf /etc/nginx/sites-enabled/fk_blog.conf
sudo mysql_secure_installation
sudo cat /etc/mysql/debian.cnf
mysql -u debian-sys-maint -p
use mysql;
update user set authentication_string=password('xxxx') where user='root' and Host='localhost';
update user set plugin='mysql_native_password';
flush privileges;
mysql -u root -p
CREATE DATABASE IF NOT EXISTS xxxx DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create user 'xxxx'@'localhost' identified by 'xxxx';
grant all privileges on xxxx.* to 'xxxx'@'localhost' identified by 'xxxx';
grant create,alter,drop,select,insert,update,delete on xxxx.* to 'xxxx'@'localhost';
flush privileges;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment