move ubuntu file to linux
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# Prometheus
|
||||
|
||||
## Prometheus
|
||||
|
||||
> https://prometheus.io/docs/prometheus/latest/getting_started/
|
||||
|
||||
```bash
|
||||
tar xvfz prometheus-*.tar.gz
|
||||
cd prometheus-*
|
||||
|
||||
```
|
||||
|
||||
## grafana
|
||||
|
||||
> https://grafana.com/docs/installation/debian/
|
||||
|
||||
```bash
|
||||
wget https://dl.grafana.com/oss/release/grafana_5.4.2_amd64.deb
|
||||
sudo apt-get install -y adduser libfontconfig1
|
||||
sudo dpkg -i grafana_5.4.2_amd64.deb
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
# apt 源
|
||||
|
||||
## ubuntu 18.04
|
||||
|
||||
```bash
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic universe
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates universe
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-security universe
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-security multiverse
|
||||
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
# ubuntu 下安装使用 aria2
|
||||
|
||||
- http://blog.csdn.net/crazycui/article/details/52205908
|
||||
|
||||
## 安装
|
||||
|
||||
> sudo apt install aria2
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
# env
|
||||
|
||||
``` bash
|
||||
# deb cdrom:[Ubuntu 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801)]/ xenial main restricted
|
||||
|
||||
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
|
||||
# newer versions of the distribution.
|
||||
# deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
|
||||
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
|
||||
|
||||
## Major bug fix updates produced after the final release of the
|
||||
## distribution.
|
||||
# deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
|
||||
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
|
||||
|
||||
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
||||
## team. Also, please note that software in universe WILL NOT receive any
|
||||
## review or updates from the Ubuntu security team.
|
||||
# deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe
|
||||
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
|
||||
# deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
|
||||
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
|
||||
|
||||
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
||||
## team, and may not be under a free licence. Please satisfy yourself as to
|
||||
## your rights to use the software. Also, please note that software in
|
||||
## multiverse WILL NOT receive any review or updates from the Ubuntu
|
||||
## security team.
|
||||
# deb http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
|
||||
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
|
||||
# deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
|
||||
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
|
||||
|
||||
## N.B. software from this repository may not have been tested as
|
||||
## extensively as that contained in the main release, although it includes
|
||||
## newer versions of some applications which may provide useful features.
|
||||
## Also, please note that software in backports WILL NOT receive any review
|
||||
## or updates from the Ubuntu security team.
|
||||
# deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
|
||||
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
|
||||
|
||||
## Uncomment the following two lines to add software from Canonical's
|
||||
## 'partner' repository.
|
||||
## This software is not part of Ubuntu, but is offered by Canonical and the
|
||||
## respective vendors as a service to Ubuntu users.
|
||||
# deb http://archive.canonical.com/ubuntu xenial partner
|
||||
# deb-src http://archive.canonical.com/ubuntu xenial partner
|
||||
|
||||
# deb http://security.ubuntu.com/ubuntu xenial-security main restricted
|
||||
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
|
||||
# deb http://security.ubuntu.com/ubuntu xenial-security universe
|
||||
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
|
||||
# deb http://security.ubuntu.com/ubuntu xenial-security multiverse
|
||||
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
|
||||
|
||||
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
|
||||
deb http://archive.canonical.com/ubuntu xenial partner
|
||||
deb-src http://archive.canonical.com/ubuntu xenial partner
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
|
||||
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
|
||||
|
||||
deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial stable
|
||||
# deb-src [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial stable
|
||||
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
# install nginx on ubuntu 14.04
|
||||
@@ -0,0 +1,13 @@
|
||||
# /etc/network/interface 配置
|
||||
|
||||
|
||||
## static ip
|
||||
|
||||
``` bash
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address 192.168.2.34
|
||||
netmask 255.255.255.0
|
||||
gateway 192.0.2.254
|
||||
dns-nameservers 114.114.114.114
|
||||
```
|
||||
@@ -0,0 +1,42 @@
|
||||
# linux 下使用iptables 做路由转发
|
||||
|
||||
- 参考自 http://blog.csdn.net/whatday/article/details/53634954
|
||||
|
||||
## 环境
|
||||
|
||||
两台设备:
|
||||
ubuntu 16.04
|
||||
eth0 192.168.1.2/24 192.168.1.2
|
||||
wlan0 10.138.177.83 *.*.*.*
|
||||
raspberry pi b+
|
||||
eth0 192.168.1.10/24 192.168.1.2
|
||||
|
||||
## iptables 命令
|
||||
|
||||
参考自 http://man.linuxde.net/iptables
|
||||
|
||||
``` bash
|
||||
iptables -t 表名 <-A/I/D/R> 规则链名 [规则号] <-i/o 网卡名> -p 协议名 <-s 源IP/源子网> --sport 源端口 <-d 目标IP/目标子网> --dport 目标端口 -j 动作
|
||||
|
||||
```
|
||||
|
||||
## 转发80端口到其他端口
|
||||
|
||||
``` bash
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 4000
|
||||
```
|
||||
|
||||
## 设置静态ip
|
||||
|
||||
> sudo nano /etc/network/interfaces
|
||||
|
||||
``` bash
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address 192.168.8.100
|
||||
netmask 255.255.255.0
|
||||
gateway 192.168.8.2
|
||||
dns-nameserver 119.29.29.29
|
||||
```
|
||||
|
||||
> sudo /etc/init.d/networking restart # 重启网络
|
||||
@@ -0,0 +1,87 @@
|
||||
# iptables 设置端口转发/映射
|
||||
|
||||
## 网络拓扑
|
||||
|
||||

|
||||
|
||||
服务器A有两个网卡
|
||||
内网ip:192.168.1.3
|
||||
外网ip:10.138.108.103
|
||||
本地回环:127.0.0.1
|
||||
|
||||
服务器B有网卡,8001提供服务
|
||||
内网ip:192.168.1.1
|
||||
|
||||
## 目的
|
||||
|
||||
使用户通过外网10.138.108.103:8001访问内网服务器192.168.1.1:8001
|
||||
|
||||
## 思路
|
||||
|
||||

|
||||
|
||||
如图2所示,端口转发走的是下发A路,利用nat表中prerouting做dnat,用postrouting做snat
|
||||
|
||||
### 包分析
|
||||
|
||||
时期 |操作|源IP:PORT|目的IP:PORT
|
||||
------- |----|----|----
|
||||
packet in|用户访问|1.2.3.4:5|10.138.108.103:8001
|
||||
prerouting|dnat|1.2.3.4:5|192.168.1.1:8001
|
||||
routing decision|判断是否转发|1.2.3.4:5|192.168.1.1:8001
|
||||
postrouting|snat|10.138.108.103:X|192.168.1.1:8001
|
||||
packet out|转发包|10.138.108.103:X|192.168.1.1:8001
|
||||
|
||||
## 开启内核ip转发
|
||||
|
||||
> nano /etc/sysctl.conf
|
||||
|
||||
将下项注释去掉
|
||||
|
||||
``` bash
|
||||
# net.ipv4.ip_forward=1
|
||||
```
|
||||
|
||||
使改动生效
|
||||
> sudo sysctl -p
|
||||
|
||||
## 脚本
|
||||
|
||||
``` bash
|
||||
#!/bin/bash
|
||||
pro='tcp'
|
||||
|
||||
src_host1='192.168.1.3'
|
||||
src_host2='10.138.108.103'
|
||||
src_port=8001
|
||||
|
||||
Dst_Host='192.168.1.1'
|
||||
Dst_Port=8001
|
||||
|
||||
# 清空规则
|
||||
iptables -F
|
||||
iptables -X
|
||||
iptables -Z
|
||||
iptables -t nat -F
|
||||
|
||||
# Destination network address translate (dnat)
|
||||
|
||||
# 如图2所示
|
||||
iptables -t nat -A PREROUTING -p $pro -d $src_host1 --dport $src_port -j DNAT --to $Dst_Host:$Dst_Port
|
||||
iptables -t nat -A PREROUTING -p $pro -d $src_host2 --dport $src_port -j DNAT --to $Dst_Host:$Dst_Port
|
||||
|
||||
|
||||
iptables -A FORWARD -p $pro -d $Dst_Host --dport $Dst_Port -j ACCEPT
|
||||
|
||||
# 本地连接不经过prerouting,只经过output链,所以想要在服务器A通过本地ip访问服务器B需要在output 链增加dnat规则
|
||||
iptables -t nat -A OUTPUT -p $pro -d $src_host1 --dport $src_port -j DNAT --to $Dst_Host:$Dst_Port
|
||||
iptables -t nat -A OUTPUT -p $pro -d $src_host2 --dport $src_port -j DNAT --to $Dst_Host:$Dst_Port
|
||||
|
||||
|
||||
|
||||
# source network address translate (snat)
|
||||
iptables -t nat -A POSTROUTING -p $pro -d $Dst_Host --dport $Dst_Port -j SNAT --to $src_host1
|
||||
|
||||
# 显示已有规则
|
||||
iptables -t nat -L -n --line-number
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
# minicom note
|
||||
|
||||
# install
|
||||
|
||||
> sudo apt-get install minicom
|
||||
|
||||
# set default config
|
||||
|
||||
> sudo minicom -s
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
sudo ifconfig wlan0 down
|
||||
sudo iwconfig wlan0 mode Monitor
|
||||
sudo ifconfig wlan0 up
|
||||
|
||||
## if rfkill error
|
||||
rfkill unblock wifi
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# net.sh
|
||||
# Copyright (C) 2019 light <light@light-laptop>
|
||||
#
|
||||
# Distributed under terms of the MIT license.
|
||||
#
|
||||
|
||||
|
||||
LANG=""
|
||||
while true
|
||||
do
|
||||
up_time1=`ifconfig $1 | grep "bytes" | awk '{print $6}'`
|
||||
down_time1=`ifconfig $1 | grep "bytes" | awk '{print $2}'`
|
||||
|
||||
sleep 1
|
||||
clear
|
||||
|
||||
up_time2=`ifconfig $1 | grep "bytes" | awk '{print $6}'`
|
||||
down_time2=`ifconfig $1 | grep "bytes" | awk '{print $2}'`
|
||||
|
||||
up_time1=${up_time1}
|
||||
up_time2=${up_time2}
|
||||
down_time1=${down_time1}
|
||||
down_time2=${down_time2}
|
||||
|
||||
up_time=`expr $up_time2 - $up_time1`
|
||||
down_time=`expr $down_time2 - $down_time1`
|
||||
up_time=`expr $up_time / 1024`
|
||||
down_time=`expr $down_time / 1024`
|
||||
|
||||
echo 上传速度: $up_time kb/s
|
||||
echo 下载速度: $down_time kb/s
|
||||
done
|
||||
@@ -0,0 +1 @@
|
||||
nmap -v -sP 192.168.1.0/24
|
||||
@@ -0,0 +1 @@
|
||||
scp -P 2210 -r static pi@myserver:/home/pi/
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
``` bash
|
||||
screen -ls
|
||||
screen -r name
|
||||
screen -d name
|
||||
|
||||
screen -dmS name ngrok start client ssh server
|
||||
screen -dmS ngrok ngrok start client ssh server
|
||||
screen -dmS sslocal sslocal -c /etc/shadowsocks.json -d start
|
||||
|
||||
screen -dmS test ngrokStart -d
|
||||
sudo ./bin/ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="ngrok.hellolight.me" -httpAddr=":8081" -httpsAddr=":8082"
|
||||
|
||||
sudo screen -S 12597 -X quit
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
# sudo
|
||||
|
||||
|
||||
|
||||
> sudo visudo
|
||||
|
||||
|
||||
``` bash
|
||||
|
||||
%sudo ALL=(ALL:ALL) ALL
|
||||
|
||||
# 改成
|
||||
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
|
||||
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
# synergy
|
||||
|
||||
```bash
|
||||
sudo apt install synergy
|
||||
sudo apt-get install sni-qt
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
# Ubuntu 实时显示网速、CPU占用等状态
|
||||
|
||||
|
||||
``` bash
|
||||
sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor
|
||||
sudo apt-get update
|
||||
sudo apt-get install indicator-sysmonitor
|
||||
indicator-sysmonitor &
|
||||
```
|
||||
@@ -0,0 +1,22 @@
|
||||
# ubuntu 安装 pyqt4
|
||||
- ubuntu14.04 64 python 2.6
|
||||
- refer to
|
||||
- http://blog.csdn.net/tao_627/article/details/46529587
|
||||
|
||||
## 安装
|
||||
``` bash
|
||||
$ sudo apt-get install libxext6 libxext-dev libqt4-dev libqt4-gui libqt4-sql
|
||||
$ sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer
|
||||
$ sudo apt-get install python-qt4
|
||||
$ sudo apt-get install python-qt4-*
|
||||
$ sudo apt-get install python-qscintilla2
|
||||
```
|
||||
|
||||
|
||||
## 测试
|
||||
``` bash
|
||||
$ python
|
||||
|
||||
>>> import PyQt4
|
||||
>>>
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
# ubuntu 16.04 安装使用 uget
|
||||
|
||||
> http://www.cnblogs.com/EasonJim/p/7119294.html
|
||||
|
||||
|
||||
## 安装uget
|
||||
|
||||
``` bash
|
||||
sudo add-apt-repository ppa:plushuang-tw/uget-stable
|
||||
sudo apt update
|
||||
sudo apt install uget
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo add-apt-repository ppa:t-tujikawa/ppa
|
||||
sudo apt update
|
||||
sudo apt install aria2
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
# update-alternatives
|
||||
|
||||
``` bash
|
||||
# 设置优先级
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
|
||||
# 查询版本
|
||||
sudo update-alternatives --query gcc
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
# user
|
||||
|
||||
|
||||
## create user
|
||||
|
||||
```bash
|
||||
useradd git
|
||||
|
||||
# 制定用户默认的shell
|
||||
chsh git -s /bin/bash
|
||||
|
||||
|
||||
# 更改权限
|
||||
chown -R git:git /home/git
|
||||
```
|
||||
|
||||
|
||||
|
||||
## auth
|
||||
|
||||
```bash
|
||||
## 只修改文件权限 -type d 为修改目录权限
|
||||
find workspace -type f -exec chmod 644 {} \;
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
# vnc for ubuntu
|
||||
|
||||
## xfce4
|
||||
|
||||
远程桌面选用xfce, gnome 极消耗带宽资源
|
||||
|
||||
```bash
|
||||
sudo apt install xfce4 xfce4-goodies
|
||||
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
|
||||
nano ~/.vnc/xstartup
|
||||
```
|
||||
|
||||
```bash
|
||||
~/.vnc/xstartup
|
||||
#!/bin/bash
|
||||
xrdb $HOME/.Xresources
|
||||
startxfce4 &
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
``` bash
|
||||
sudo apt install -y zsh
|
||||
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
chsh -s /bin/zsh
|
||||
sudo reboot -h now
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
iw list | grep -A 10 "Supported interface modes"
|
||||
Reference in New Issue
Block a user