├── .gitignore ├── LICENSE ├── Linux ├── CentOS │ ├── 6.5,6.8-x64 │ │ ├── Git,SSH,Zsh,Tmux │ │ │ ├── install-ssh.sh │ │ │ ├── install-tmux.sh │ │ │ └── install-zsh.sh │ │ ├── Java │ │ │ ├── install-java8.sh │ │ │ └── readme.md │ │ ├── Nginx │ │ │ ├── install-nginx.sh │ │ │ ├── nginx.repo │ │ │ └── readme.md │ │ ├── Oracle11g │ │ │ ├── 01.preinstallation-requirements │ │ │ │ ├── 00.check-list.md │ │ │ │ ├── 01.prepare-install-java8.sh │ │ │ │ ├── 02.prepare-install-vnc.md │ │ │ │ ├── 02.prepare-install-vncserver.sh │ │ │ │ ├── 03.prepare-add-cn-font.sh │ │ │ │ ├── 04.prepare-install-oracle-require-libs.sh │ │ │ │ ├── 05.create-db-user.sh │ │ │ │ ├── 06.init-aliyun-hostname.sh │ │ │ │ ├── 07.fix-swap-size.sh │ │ │ │ ├── 08.upload-and-unzip-oracle-11g.sh │ │ │ │ ├── aliyun-hosts │ │ │ │ ├── aliyun-ifcfg-eth1 │ │ │ │ ├── aliyun-network │ │ │ │ ├── readme.md │ │ │ │ └── zysong.ttf │ │ │ ├── 02.install-oracle │ │ │ │ └── install-oracle11g.sh │ │ │ ├── 03.config-oracle │ │ │ │ ├── etc-oratab │ │ │ │ └── set-run-as-boot.sh │ │ │ ├── readme.md │ │ │ └── tips │ │ │ │ └── oracle-cmd-tips.md │ │ ├── Python │ │ │ ├── readme.md │ │ │ └── yum-install-python.sh │ │ ├── Tomcat │ │ │ ├── install-tomcat7.sh │ │ │ └── readme.md │ │ └── readme.md │ └── 7.x-x64 │ │ └── docker │ │ ├── install-docker.sh │ │ └── readme.md ├── Ubuntu │ └── 14.04-x64 │ │ ├── Docker │ │ ├── install-docker.sh │ │ └── readme.md │ │ ├── Git,SSH,Zsh,Tmux │ │ ├── install-git,zsh,tmux.sh │ │ └── install-ssh.sh │ │ ├── Java │ │ └── install-java8.sh │ │ ├── MongoDB │ │ ├── install-mongodb2.6.sh │ │ ├── install-mongodb3.0.sh │ │ └── readme.md │ │ ├── Nginx │ │ ├── install-nginx.sh │ │ └── readme.md │ │ ├── Python │ │ ├── install-python-by-src-code.sh │ │ └── install-python.sh │ │ ├── Tomcat │ │ ├── install-tomcat-by-src-code.sh │ │ └── readme.md │ │ ├── ffmpeg │ │ ├── install-ffmpeg.sh │ │ └── readme.md │ │ └── readme.md └── apt-yum-mirrors │ ├── CentOS6-Base-163.repo │ ├── CentOS7-Base-163.repo │ ├── readme.md │ └── sources.list.trusty ├── MacOSX ├── Go │ ├── brew-install-glide.sh │ ├── brew-install-go.sh │ └── readme.md ├── Jenkins │ ├── install-jenkins-log.txt │ └── install-jenkins.sh ├── MongoDB │ ├── install-mongodb-log.txt │ ├── install-mongodb.sh │ └── readme.md ├── MySQL │ ├── init-mysql-step.txt │ ├── install-mysql-log.txt │ ├── install-mysql.sh │ └── readme.md ├── Nginx │ ├── install-nginx-log.txt │ ├── install-nginx.sh │ └── readme.md ├── Nodejs │ ├── brew-install.sh │ ├── cnpm-install.sh │ ├── npm-install-cnpm.sh │ └── uninstall.sh ├── OsxFix │ └── fix-open-way-issue.sh ├── PostgreSQL │ └── uninstall.sh ├── Python │ ├── brew-install-pyenv.sh │ └── readme.md ├── RabbitMQ │ ├── install-rabbitmq-log.txt │ ├── install-rabbitmq.sh │ └── readme.md ├── Redis │ ├── install-redis-log.txt │ └── install-redis.sh ├── Tomcat │ ├── install-tomcat-log.txt │ └── install-tomcat7.sh ├── Vim │ ├── install-vim-log.txt │ ├── install-vim.sh │ └── vim-config.sh ├── brew-cask-install.sh ├── brew-install-jenkins.md ├── brew-install-py2.7.sh ├── brew-install.sh ├── fix-user-permission.sh └── readme.md ├── README.md ├── docker ├── Dockerfile │ ├── ranzi-oa │ │ ├── Dockerfile │ │ ├── docker-compose.yml │ │ └── readme.md │ ├── readme.md │ ├── xiaowei-oa │ │ ├── Dockerfile │ │ └── readme.md │ └── zentao-pms │ │ ├── Dockerfile │ │ ├── docker-compose.yml │ │ └── readme.md └── README.md └── pip ├── pip-aliyun-mirrors ├── config-pip-mirrors.sh └── pip.conf ├── pip-install-flask-dev.sh ├── pip-install-tornado-dev.sh ├── readme.md └── requirements ├── base.txt ├── django-requirements.txt ├── flask-requirements.txt ├── tools.txt └── tornado-requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Node rules: 2 | ## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 3 | .grunt 4 | 5 | ## Dependency directory 6 | ## Commenting this out is preferred by some people, see 7 | ## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git 8 | node_modules 9 | 10 | # Book build output 11 | _book 12 | 13 | # eBook build output 14 | *.epub 15 | *.mobi 16 | *.pdf 17 | 18 | 19 | # tmp 20 | tmp/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 hhstore 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Git,SSH,Zsh,Tmux/install-ssh.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # install, centos 6.8 has install. 4 | sudo yum install -y ssh 5 | 6 | # start ssh service 7 | sudo service sshd start 8 | 9 | # start at boot 10 | sudo chkconfig sshd on 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Git,SSH,Zsh,Tmux/install-tmux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sudo yum update -y 4 | 5 | sudo yum install -y tmux 6 | 7 | tmux -V 8 | # tmux 1.6 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Git,SSH,Zsh,Tmux/install-zsh.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################ 4 | # 5 | # 参考: https://github.com/robbyrussell/oh-my-zsh/ 6 | # 7 | ############################################################ 8 | 9 | 10 | sudo yum update -y 11 | 12 | # install 13 | sudo yum install -y zsh curl git 14 | 15 | # install oh-my-zsh 16 | 17 | # 方法1: 18 | sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 19 | 20 | # 方法2: 21 | # curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh 22 | 23 | # 方法3: 24 | # wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh 25 | 26 | 27 | # change default shell 28 | chsh -s /bin/zsh 29 | 30 | echo $SHELL 31 | 32 | 33 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Java/install-java8.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # Install Oracle Java 8 JDK 5 | 6 | cd ~ 7 | wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.rpm" 8 | 9 | 10 | sudo yum localinstall jdk-8u60-linux-x64.rpm 11 | 12 | 13 | #rm ~/jdk-8u60-linux-x64.rpm 14 | 15 | 16 | # 添加环境变量 17 | 18 | sudo sh -c "echo export JAVA_HOME=/usr/java/jdk1.8.0_60/jre >> /etc/environment" -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Java/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # centos 安装 java8 4 | 5 | - 注意设置 java 环境变量 6 | 7 | 8 | ## 参考: 9 | - [How To Install Java on CentOS and Fedora](https://www.digitalocean.com/community/tutorials/how-to-install-java-on-centos-and-fedora) 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Nginx/install-nginx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # copy 5 | sudo cp ./nginx.repo /etc/yum.repos.d/ 6 | 7 | 8 | sudo yum update -y 9 | 10 | sudo yum search nginx 11 | 12 | # install 13 | sudo yum install -y nginx 14 | 15 | 16 | nginx -v 17 | # nginx version: nginx/1.10.1 18 | 19 | 20 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Nginx/nginx.repo: -------------------------------------------------------------------------------- 1 | [nginx] 2 | name=nginx repo 3 | baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ 4 | gpgcheck=0 5 | enabled=1 6 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Nginx/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## nginx 官方安装文档: 5 | 6 | - [nginx-install](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/) 7 | 8 | - 官方文档提供 全平台安装说明, 包括 centos, redhat, Ubuntu 等 9 | - 此安装方法为 安装nginx 最新版本 10 | - 当前最新版本: nginx version: nginx/1.10.1 11 | - 日期: 2016-07-14 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/00.check-list.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 1. root 用户操作: 4 | 5 | ### 1.0 拷贝安装初始化脚本包: 6 | 7 | ``` 8 | 9 | scp * root@120.25.205.143:init-posp 10 | 11 | ``` 12 | 13 | ### 1.1 安装必要软件: 14 | 15 | - 安装 zsh, git, java7(java8) 16 | - 开启 ssh 17 | - 关闭 防火墙 18 | 19 | ### 1.2 开启 SSH: 20 | 21 | ``` 22 | 23 | sudo service sshd start 24 | sudo chkconfig sshd on 25 | 26 | ``` 27 | 28 | ### 1.3 更改 hostname: 29 | 30 | - vim /etc/sysconfig/network 31 | - vim /etc/hosts 32 | 33 | ### 1.4 设置静态 IP: 34 | ### 1.5 创建 oralce 用户: 35 | - centos 和 Ubuntu 创建用户命令, 有差异, 不通用 36 | - 执行脚本: 37 | - 查看用户创建成功: id oracle 38 | - 给 oracle 用户 添加 root 权限: 39 | - vim /etc/sudoers 40 | 41 | ``` 42 | ## Allow root to run any commands anywhere 43 | root ALL=(ALL) ALL 44 | oracle ALL=(ALL) ALL 45 | 46 | 47 | ``` 48 | 49 | 50 | ### 1.6 重启主机 51 | - 查看 hostname: 52 | - hostname 53 | 54 | 55 | 56 | ## 2. oracle 用户操作: 57 | 58 | 59 | ### 2.1 上传 Oracle 11g 安装包: 60 | 61 | - scp 上传 62 | - ftp 上传 63 | - wget 官网下载(需要用户口令参数) 64 | - uzip 解压 65 | 66 | 67 | ### 2.2 解压安装包: 68 | 69 | ``` 70 | #[oracle@posp-dev orcl]$ pwd 71 | #/home/oracle/orcl 72 | 73 | #[oracle@posp-dev orcl]$ ls 74 | #database linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip 75 | 76 | unzip linux.x64_11gR2_database_1of2.zip 77 | unzip linux.x64_11gR2_database_2of2.zip 78 | 79 | ``` 80 | 81 | ### 2.3 安装 oracle 依赖包: 82 | 83 | - 注意 32位,64位, 似乎装64位的不影响适用,忽略报错警告 84 | 85 | 86 | ### 2.4 安装条件检查: 87 | 88 | 89 | ``` 90 | # 内存推荐2GB以上 91 | # grep MemTotal /proc/meminfo 92 | # free 93 | 94 | 95 | # swap 分区设置见下 96 | # swapon -s 97 | 98 | # /tmp 目录大于1G 99 | # df -h /tmp 100 | # du -sm /tmp 101 | 102 | # 磁盘空间应该都没问题 103 | df -h 104 | 105 | # 系统架构 106 | # cat /proc/version 107 | # uname -a 108 | # uname -r 109 | # lsb_release -a 110 | 111 | 112 | ``` 113 | 114 | ### 2.5 内核欺骗脚本(可忽略,建议不使用). 115 | 116 | - 会导致 VNC 安装失败, 要先安装 VNC 之后, 再执行此脚本. 117 | - 此脚本在 GUI 安装方式时, 为非必须的.可以不执行. 118 | - centos2ol.sh 119 | 120 | 121 | ### 2.6 安装: 122 | 123 | - oracle 11g 企业版, 图形界面安装 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/01.prepare-install-java8.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################### 4 | # download and install java8 5 | ############################################################### 6 | 7 | # download and install java8 8 | 9 | cd ~ 10 | wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.rpm" 11 | 12 | # install 13 | sudo yum localinstall -y jdk-8u60-linux-x64.rpm 14 | 15 | java -version 16 | 17 | # add java-env: 18 | sudo sh -c "echo export JAVA_HOME=/usr/java/jdk1.8.0_60/jre >> /etc/environment" 19 | 20 | # refresh env 21 | sudo source /etc/environment 22 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/02.prepare-install-vnc.md: -------------------------------------------------------------------------------- 1 | 2 | # 安装 VNCserver: 3 | 4 | 5 | ## 1. 参考文档: 6 | 7 | - [阿里云上CentOS的图形访问](http://www.jianshu.com/p/ad68f78f1419) 8 | - [CentOS6.5安装vncserver实现图形化访问](https://help.aliyun.com/knowledge_detail/5974462.html) 9 | - [Ubuntu安装vncserver实现图形化访问](https://help.aliyun.com/knowledge_detail/5974461.html) 10 | 11 | 12 | ## 2. 安装: 13 | 14 | ### 2.1 给 centos 云主机安装 GUI 15 | 16 | 17 | ### 2.2 配置 VNC 密码: 18 | 19 | - 注意,切换到 oracle 用户下, 做后续修改配置 20 | 21 | 22 | ```bash 23 | # 启动: vncserver 24 | # 根据提示,设置登录连接密码: 25 | 26 | [oracle@posp-prod ~]$ vncserver 27 | 28 | You will require a password to access your desktops. 29 | 30 | Password: 31 | Verify: 32 | xauth: file /home/oracle/.Xauthority does not exist 33 | 34 | New 'posp-prod:1 (oracle)' desktop is posp-prod:1 35 | 36 | Creating default startup script /home/oracle/.vnc/xstartup 37 | Starting applications specified in /home/oracle/.vnc/xstartup 38 | Log file is /home/oracle/.vnc/posp-prod:1.log 39 | 40 | 41 | 42 | # 修改配置: 43 | [oracle@posp-prod ~]$ cd ~/.vnc/ 44 | 45 | 46 | ``` 47 | 48 | 49 | 50 | 51 | ### 2.3 配置为使用gnome桌面 52 | 53 | - 修改 /root/.vnc/xstartup文件, 54 | - 把最后的 twm & 删掉 加上 gnome-session & 55 | 56 | 57 | 58 | ``` 59 | [oracle@posp-dev .vnc]$ pwd 60 | /home/oracle/.vnc 61 | 62 | 63 | [oracle@posp-dev .vnc]$ cat xstartup 64 | 65 | 66 | 67 | #!/bin/sh 68 | 69 | [ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n 70 | export LANG 71 | export SYSFONT 72 | vncconfig -iconic & 73 | unset SESSION_MANAGER 74 | unset DBUS_SESSION_BUS_ADDRESS 75 | OS=`uname -s` 76 | if [ $OS = 'Linux' ]; then 77 | case "$WINDOWMANAGER" in 78 | *gnome*) 79 | if [ -e /etc/SuSE-release ]; then 80 | PATH=$PATH:/opt/gnome/bin 81 | export PATH 82 | fi 83 | ;; 84 | esac 85 | fi 86 | if [ -x /etc/X11/xinit/xinitrc ]; then 87 | exec /etc/X11/xinit/xinitrc 88 | fi 89 | if [ -f /etc/X11/xinit/xinitrc ]; then 90 | exec sh /etc/X11/xinit/xinitrc 91 | fi 92 | [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources 93 | xsetroot -solid grey 94 | xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & 95 | 96 | gnome-session & 97 | 98 | #twm & 99 | 100 | ``` 101 | 102 | 103 | 104 | ### 2.4 修改 vnc 配置: 105 | 106 | ``` 107 | # 查看配置内容: 108 | [oracle@posp-dev .vnc]$ cat /etc/sysconfig/vncservers 109 | 110 | 111 | # The VNCSERVERS variable is a list of display:user pairs. 112 | # 113 | # Uncomment the lines below to start a VNC server on display :2 114 | # as my 'myusername' (adjust this to your own). You will also 115 | # need to set a VNC password; run 'man vncpasswd' to see how 116 | # to do that. 117 | # 118 | # DO NOT RUN THIS SERVICE if your local area network is 119 | # untrusted! For a secure way of using VNC, see this URL: 120 | # https://access.redhat.com/knowledge/solutions/7027 121 | 122 | # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. 123 | 124 | # Use "-localhost" to prevent remote VNC clients connecting except when 125 | # doing so through a secure tunnel. See the "-via" option in the 126 | # `man vncviewer' manual page. 127 | 128 | # VNCSERVERS="2:myusername" 129 | # VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" 130 | # 131 | # 132 | # 133 | 134 | VNCSERVERS="1:oracle" 135 | 136 | 137 | 138 | ``` 139 | 140 | 141 | 142 | ## 3. 配置方法2: 143 | 144 | ``` 145 | 146 | 147 | # 修改 /root/.vnc/xstartup文件,把最后的 twm & 删掉 加上 gnome-session &。 148 | 149 | # 修改/etc/sysconfig/vncservers 文件 150 | 151 | 152 | VNCSERVERS="1:root" 153 | # 桌面号:用户 监听 590* 端口 154 | VNCSERVERARGS[1]="-geometry 1200x800" 155 | 156 | 157 | sed -i 's/.*!= root.*/#&/' /etc/pam.d/gdm 158 | dbus-uuidgen >/var/lib/dbus/machine-id 159 | 160 | 161 | # 重启服务: 162 | service vncserver restart 163 | 164 | chkconfig --del NetworkManager 165 | 166 | service iptables stop 167 | chkconfig iptables off 168 | 169 | 170 | # 关闭VNCserver , 输入 vncserver -kill :2 171 | 172 | ``` -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/02.prepare-install-vncserver.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # user: root 4 | 5 | sudo yum groupinstall -y "X Window System" 6 | sudo yum groupinstall -y "Desktop" 7 | sudo yum groupinstall -y "Chinese Support" 8 | 9 | 10 | sudo yum install -y tigervnc-server 11 | 12 | 13 | chkconfig --level 345 vncserver on 14 | 15 | 16 | 17 | # change to user: oralce 18 | 19 | su oracle 20 | 21 | 22 | cd ~ 23 | 24 | 25 | vncserver 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/03.prepare-add-cn-font.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # mkdir 5 | sudo mkdir -p /usr/share/fonts/zh_CN/TrueType 6 | 7 | # copy 8 | sudo cp zysong.ttf /usr/share/fonts/zh_CN/TrueType/ 9 | 10 | # check: 11 | ls /usr/share/fonts/zh_CN/TrueType 12 | 13 | # lang: 14 | echo "current language: " ${LANG} 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/04.prepare-install-oracle-require-libs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # install oracle require libs 5 | # 安装 Oracle 11g 依赖的包 6 | # x64位系统,安装64位库, 可忽略32位警告 7 | # 8 | function yum_install_oracle_require_libs() { 9 | echo "yum install libs for oracle 11g:" 10 | sudo yum update -y 11 | sudo yum install -y binutils 12 | sudo yum install -y compat-libcap1 13 | sudo yum install -y compat-libstdc++-33 14 | sudo yum install -y compat-libstdc++-33*.i686 15 | sudo yum install -y elfutils-libelf-devel 16 | sudo yum install -y gcc 17 | sudo yum install -y gcc-c++ 18 | sudo yum install -y glibc*.i686 19 | sudo yum install -y glibc 20 | sudo yum install -y glibc-devel 21 | sudo yum install -y glibc-devel*.i686 22 | sudo yum install -y ksh 23 | sudo yum install -y libgcc*.i686 24 | sudo yum install -y libgcc 25 | sudo yum install -y libstdc++ 26 | sudo yum install -y libstdc++*.i686 27 | sudo yum install -y libstdc++-devel 28 | sudo yum install -y libstdc++-devel*.i686 29 | sudo yum install -y libaio 30 | sudo yum install -y libaio*.i686 31 | sudo yum install -y libaio-devel 32 | sudo yum install -y libaio-devel*.i686 33 | sudo yum install -y make 34 | sudo yum install -y sysstat 35 | sudo yum install -y unixODBC 36 | sudo yum install -y unixODBC*.i686 37 | sudo yum install -y unixODBC-devel 38 | sudo yum install -y unixODBC-devel*.i686 39 | sudo yum install -y libXp 40 | sudo yum install -y elfutils-libelf-devel-static 41 | sudo yum install -y numactl-devel 42 | sudo yum install -y pcre-devel 43 | sudo yum install -y glibc.i686 44 | sudo yum install -y pdksh 45 | 46 | } 47 | 48 | 49 | 50 | yum_install_oracle_require_libs 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/05.create-db-user.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # 5 | # 方案一: 6 | # 将 Oracle 安装在 /home/oracle 目录下, 默认采用此方案 7 | # 8 | function create_user_group() { 9 | echo "create oracle user & dba group" 10 | sudo groupadd oinstall 11 | sudo groupadd dba 12 | sudo useradd -g oinstall -G dba -d /home/oracle oracle 13 | echo "create oracle user & group success!" 14 | 15 | # set oracle-user-password: [oracle] 16 | sudo echo "oracle" | passwd --stdin oracle 17 | 18 | # check: 19 | id oracle 20 | 21 | } 22 | 23 | 24 | # 25 | # 方案二: 26 | # 将 Oracle 安装在 /u01/app/oracle 路径下 27 | # 28 | function create_db_dir() { 29 | # create db-dir: 30 | sudo mkdir -p /u01/app/oracle/product/11.2.0/db_1 31 | 32 | sudo chown -R oracle:oinstall /u01/app 33 | sudo chmod -R 775 /u01/app 34 | 35 | } 36 | 37 | 38 | 39 | create_user_group 40 | # create_db_dir 41 | 42 | 43 | # 44 | # posp 45 | # p,3 46 | # 47 | 48 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/06.init-aliyun-hostname.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # 输出服务器原默认配置参数: 5 | function show_default_config() { 6 | echo "the server default config:" 7 | echo "*******************************" 8 | echo "/etc/sysconfig/network:" 9 | echo 10 | sudo cat /etc/sysconfig/network 11 | 12 | echo "*******************************" 13 | echo "/etc/hosts:" 14 | echo 15 | sudo cat /etc/hosts 16 | 17 | echo "*******************************" 18 | echo "/etc/sysconfig/network-scripts/ifcfg-eth1:" 19 | echo 20 | sudo cat /etc/sysconfig/network-scripts/ifcfg-eth1 21 | 22 | echo "*******************************" 23 | 24 | } 25 | 26 | 27 | 28 | # 更改主机 hostname: 29 | function set_db_server_hostname() { 30 | # /etc/sysconfig/network 31 | # /etc/hosts 32 | 33 | # backup 34 | sudo cp /etc/sysconfig/network /etc/sysconfig/network.bak 35 | sudo cp /etc/hosts /etc/hosts.bak 36 | 37 | # 阿里云设置: 38 | ALIYUN_HOSTNAME="posp-prod" 39 | ALIYUN_NETWORK="./aliyun-network" 40 | ALIYUN_HOSTS="./aliyun-hosts" 41 | 42 | # rename 43 | sudo hostname ${ALIYUN_HOSTNAME} 44 | 45 | # rewrite 46 | sudo cp ${ALIYUN_NETWORK} /etc/sysconfig/network 47 | sudo cp ${ALIYUN_HOSTS} /etc/hosts 48 | 49 | } 50 | 51 | 52 | # 设置静态 IP: 53 | function set_db_server_static_ip() { 54 | # /etc/sysconfig/network-scripts/ifcfg-eth1 55 | 56 | IFCFG="/etc/sysconfig/network-scripts/ifcfg-eth1" 57 | ALIYUN_IFCFG="./aliyun-ifcfg-eth1" 58 | 59 | # rewrite 60 | sudo cp ${ALIYUN_IFCFG} ${IFCFG} 61 | 62 | # restart network 63 | sudo service network restart 64 | 65 | echo ${IFCFG} 66 | } 67 | 68 | 69 | 70 | show_default_config 71 | set_db_server_hostname 72 | 73 | # 不一定要修改,暂时注释掉 74 | # set_db_server_static_ip 75 | 76 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/07.fix-swap-size.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################# 4 | # 说明: 5 | # 1. Oracle 安装, 系统必须开启 swap, 否则会出问题 6 | # 2. 阿里云的主机, 默认没有 swap 7 | # 3. 参考: 8 | # - https://bbs.aliyun.com/read/180907.html?spm=5176.7189909.0.0.Furmgw 9 | # - 该回答者是专业 Oracle DBA, 提供了不少解答贴, 都值得一读 10 | # - (另有 QQ 提供, 必要时候付费咨询一下) 11 | # 12 | # 13 | # 14 | ################################################# 15 | 16 | 17 | # 创建 swap 18 | 19 | # 1. 创建交换分区的文件:增加1G大小的交换分区,则命令写法如下,其中的 count 等于想要的块大小。 20 | # dd if=/dev/zero of=/home/swapfile bs=1M count=1024 21 | 22 | # 2.设置交换分区文件: 23 | # mkswap /home/swapfile #建立swap的文件系统 24 | 25 | # 3.立即启用交换分区文件: 26 | # swapon /home/swapfile #启用swap文件 27 | 28 | # 4.使系统开机时自启用,在文件/etc/fstab中添加一行: 29 | #/home/swapfile swap swap defaults 0 0 30 | 31 | 32 | # 重启后查swap还是0 33 | # 初始化安装时centos的用户默认都关闭了swap, 34 | # more /etc/rc.local 35 | 36 | # 把末尾的 swapoff -a 注释掉, 重启, swap生效 37 | 38 | 39 | 40 | ########################################## 41 | # 42 | # dd建立一个文件,mkswap,swapon 挂载 43 | # 阿里云参考: https://help.aliyun.com/knowledge_detail/42534.html 44 | # 在 readme 里, 提供的 某一系列文档, 有更好的修改实践. 注意 45 | # 46 | # 47 | ########################################## 48 | 49 | # 1、创建用于交换分区的文件: 50 | # 注: block_size、number_of_block 大小可以自定义, 51 | # 比如 bs=1M count=1024 代表设置 1G 大小 SWAP 分区。 52 | 53 | #dd if=/dev/zero of=/mnt/SWAP bs=block_size count=number_of_block 54 | # 2GB 55 | dd if=/dev/zero of=/mnt/swap bs=1M count=2048 56 | 57 | 58 | # 2、设置交换分区文件: 59 | mkswap /mnt/swap 60 | 61 | free -m 62 | 63 | 64 | # 3、立即启用交换分区文件 65 | swapon /mnt/swap 66 | 67 | free -m 68 | 69 | 70 | # 检查 71 | swapon -s 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/08.upload-and-unzip-oracle-11g.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # upload 4 | # scp 上传 5 | # ftp 上传 6 | # wget 官网下载(需要用户口令参数) 7 | # uzip 解压 8 | 9 | 10 | # 项目部署根目录: 11 | DEPLOY_BASE="/2016-deploy" 12 | 13 | sudo mkdir ${DEPLOY_BASE} 14 | sduo chmod 777 ${DEPLOY_BASE} 15 | cd ${DEPLOY_BASE} 16 | pwd 17 | 18 | 19 | 20 | # 解压 Oracle 安装包: 21 | unzip linux.x64_11gR2_database_1of2.zip 22 | unzip linux.x64_11gR2_database_2of2.zip 23 | 24 | 25 | ls 26 | 27 | 28 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/aliyun-hosts: -------------------------------------------------------------------------------- 1 | 127.0.0.1 localhost 2 | ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 3 | 4 | #10.116.37.200 iZ94fv5sjweZ 5 | 10.116.37.200 posp-prod -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/aliyun-ifcfg-eth1: -------------------------------------------------------------------------------- 1 | DEVICE=eth1 2 | ONBOOT=yes 3 | BOOTPROTO=static 4 | IPADDR=120.25.195.239 5 | NETMASK=255.255.252.0 6 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/aliyun-network: -------------------------------------------------------------------------------- 1 | NETWORKING=yes 2 | NETWORKING_IPV6=no 3 | PEERNTP=no 4 | GATEWAY=120.25.195.247 5 | 6 | #HOSTNAME=iZ94fv5sjweZ 7 | HOSTNAME=posp-prod 8 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 阿里云 Centos 安装 Oracle 必读 4 | 5 | - 这里搜集了一些文档,无意中在阿里云的 官方社区 BBS里找到, 如获至宝. 6 | - 该系列主题, 都值得一读, 涉及: 7 | - Oracle DBA 需要掌握的大量知识. 8 | - 阿里云主机,各项性能测试 9 | - Oracle 安装遇到的各种问题解决办法 10 | - Oracle 如何高效配置 11 | 12 | 13 | ## 精选参考文档: 14 | 15 | 16 | ### 参考0: 官方参考 17 | 18 | - [Oracle 官方安装教程, 非常详细,值得参考](https://docs.oracle.com/cd/B28359_01/install.111/b32002/pre_install.htm) 19 | - [alyun 官方 BBS 关于 Oracle 主题搜索](https://www.aliyun.com/ss/?k=Oracle) 20 | - 阿里云官方的 BBS 论坛, 里面的讨论, 有不少技术干货. 21 | - 遇到使用问题, 值得上去搜索看看. 22 | 23 | ### 参考1: terryma0076 24 | 25 | - [Oracle11g On ECS 实践一:Oracle11gR2 ECS SSD环境安装指南](https://bbs.aliyun.com/read/269639.html?spm=0.0.0.0.mnsOUb) 26 | - 附件文档下载: 详细的 Oracle 安装教程, 必读 27 | - [Oracle11g On ECS 实践二:Oralce On ECS OLTP 性能测试报告](https://bbs.aliyun.com/read/269641.html?spm=0.0.0.0.mnsOUb) 28 | - 附件文档下载: 详细的压力测试 29 | - swingbench 压测机 vs Oracle 数据库 30 | - SwingBench是一款免费的,跨平台的多线程性能测试工具。针对oracle基准测试非常出色 31 | - 测试结果: 32 | - 1)在ECS服务器用SSD云盘组成的oracle ASM上安装oracle ,IOPS,内存,IO不是瓶颈,CPU是瓶颈 33 | - 2)OLTP测试场景下,CPU压力在75%以内,响应时间没有明显变长 34 | - 阿里云ECS 16核64G 35 | - 高规格类型主机, 最多支持swingbench OLTP场景下200并发用户, 36 | - 低规格, 支持swingbench OLTP场景下50并发用户, 37 | - 中规格, swingbench OLTP场景下100并发用户, 38 | - [Oracle 11g On ECS 实践三:Oracle11gR2 ECS SSD DataGuard安装指导](https://bbs.aliyun.com/read/269642.html) 39 | - 附件文档下载: 配置Oracle 高可用的参考文档,必读 40 | - [Oracle11g On ECS 实践四:Oracle11g在阿里云ECS上高可用架构](https://bbs.aliyun.com/read/269643.html?spm=0.0.0.0.dwtSij) 41 | - 附件文档下载: 高可用架构方案, 必读 42 | - 方案一: 43 | - 应用及DB分别部署到VPC内, 44 | - 数据库通过RMAN将数据备份到本地SSD云盘, 45 | - 然后生成存储级快照进行备份,或者直接备份到位于同可用区的OSS存储上。 46 | - 恢复可以借助本地及OSS的备份介质进行恢复。 47 | - 适用场景:这种方案对于小型企业的生产环境,中大型企业的测试环境,开发环境是比较适用的。 48 | - 适合IOPS在50-1500的,数据量在500G以内的数据库 49 | - 方案二: 50 | - 应用及DB分别部署到VPC内 51 | - 采取oracle DataGurad进行同VPC内数据库主备同步 52 | - 同步的可以选择实时同步,也可以通过选择每天定期Apply归档日志 53 | - 从数据库通过RMAN将数据备份到本地及同可用区的OSS存储,同时将本地数据备份同步到备可用区内的OSS存储。 54 | - 容灾切换是首选实时DG切换,也可以根据定期同步的DG恢复数据库 55 | - 适用场景:本方案是针对中大型企业 56 | - 适合IOPS在2000-15000的,数据量在500G-5T以内的数据库。 57 | - 如果采用Oracle DG技术,必须要使用Oracle Enterprise版本的数据库 58 | - 方案三: 59 | - 在方案二的基础上本方案增加基于DG的异地同步,本地发生故障时可以采用方案二的解决办法。 60 | - 适用场景:本方案是针对大型企业 61 | - 架构比较适合IOPS在8000-20000的,数据量在1T-10T以内的数据库。 62 | 63 | 64 | ### 参考2: 65 | 66 | - [阿里云的Oracle的高可用](https://bbs.aliyun.com/read/274200.html) 67 | - [解答阿里云oracle用户的顾虑](https://bbs.aliyun.com/read/235209.html?spm=5176.bbsr180907.0.0.nExAGG) 68 | - 内有阿里云主机性能测试数据 69 | - [sql调优工具-mytun之十年磨一剑](https://bbs.aliyun.com/read/181774.html?spm=5176.bbsr235209.0.0.PDH5Wk) 70 | - 作者开发的一个 DBA 工具 71 | - [阿里云linux5.7安装ORACLE必读](https://bbs.aliyun.com/read/180238.html?spm=5176.bbsr235209.0.0.PDH5Wk) 72 | - 阿里云主机注意事项 73 | - 阿里云主机性能测试数据 74 | - oracle 安装, 多磁盘策略规划 75 | - 此贴中跟帖回复很多内容,不要略过. 76 | - 该作者 业务联系QQ:123614791 77 | - [阿里云的oracle故障解决案例](https://bbs.aliyun.com/read/181057.html?spm=5176.bbsr235209.0.0.PDH5Wk) 78 | - [阿里云linux安装ORACLE常见问题](https://bbs.aliyun.com/read/180907.html?spm=5176.bbsr180907.0.0.nExAGG) 79 | - Q: oracle三天两头就报:OUT of memory" 80 | - Q: 重启后查swap还是0” 81 | - Q: swap 该用多大? 82 | - Ans: 83 | - 内存: 1G~2G , swap 设置: 1.5倍内存大小. 84 | - 内存: 2G~16G, swap 设置: 等于实际内存大小 85 | - 内存: > 16G, swap 设置: 16G 86 | - Q: 减少 swap 使用? 87 | - Ans: 88 | - 为了让ORACLE所在的主机os少用swap, 防止io出现问题, 89 | - 在配置sga大小是一定参考oracle官方文档, sga占物理内存的比例不能过大。 90 | - 如果内存够用,除非有特殊情况(比如安装oracle, oracle 必须要 swap),建议不使用swap 91 | - [阿里云 ORACLE 优化](https://bbs.aliyun.com/read/181443.html?spm=5176.bbsr180907.0.0.nExAGG) 92 | - 1.增大IO带宽方面:多数据盘方案 93 | - 使用ORACLE时,多磁盘方案是首选方案。 94 | - 比如如果要买300G, 可以买3个100G。 95 | - 2. 并发时多数据盘同时工作:数据和索引放在不同的数据盘,日志单独放一数据盘 96 | - 数据盘xvdb /u02 数据文件 (data tablespace) 随机读写 30M * 20%=6M 97 | - 数据盘xvdc /u03 索引文件 (index tablespace) 随机读写 30M * 20%=6M 98 | - 数据盘xvdd /u04 日志文件(REDO LOG) 顺序写(可充分利用30M/秒的磁盘IO带宽)。 99 | - 3.减少ORACLE日志的生成量 100 | - 每秒生成的 Redo size尽量少 101 | - 数据库按功能进行拆分或简化逻辑操作,优化业务流程 102 | - 减少不必要的改, 改前先做判断,如果已是目标状态即不必更新了。 103 | - 4.优化来减少物理的读写, 以后再分解吧。 104 | 105 | - [ORACLE 数据库健康检查脚本下载--干货](https://bbs.aliyun.com/read/182376.html?spm=5176.bbsr180238.0.0.hcfnai) 106 | - [阿里云数据库迁移方案-不间断业务](https://bbs.aliyun.com/read/181568.html?spm=5176.bbsr180238.0.0.hcfnai) 107 | - 1.把生产库的备库(data guard)先迁移到阿里云 108 | - 2.在业务非高峰期时间(如晚上),把主备库的角色互换。 109 | - 3.把曾经的生产库(目前已变成了备库)迁移到阿里云。 110 | - 4.(可选)如果主备库设备有性能差异,可以再做一次主备库的角色互换。 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/zysong.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/better-sre/sre-script/93cb2a1132895965c1f064b433878fefccd24642/Linux/CentOS/6.5,6.8-x64/Oracle11g/01.preinstallation-requirements/zysong.ttf -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/02.install-oracle/install-oracle11g.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/03.config-oracle/etc-oratab: -------------------------------------------------------------------------------- 1 | # 2 | 3 | 4 | 5 | # This file is used by ORACLE utilities. It is created by root.sh 6 | # and updated by the Database Configuration Assistant when creating 7 | # a database. 8 | 9 | # A colon, ':', is used as the field terminator. A new line terminates 10 | # the entry. Lines beginning with a pound sign, '#', are comments. 11 | # 12 | # Entries are of the form: 13 | # $ORACLE_SID:$ORACLE_HOME:: 14 | # 15 | # The first and second fields are the system identifier and home 16 | # directory of the database respectively. The third filed indicates 17 | # to the dbstart utility that the database should , "Y", or should not, 18 | # "N", be brought up at system boot time. 19 | # 20 | # Multiple entries with the same $ORACLE_SID are not allowed. 21 | # 22 | # 23 | #orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N 24 | orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/03.config-oracle/set-run-as-boot.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # 设置 Oracle 开机启动: 5 | # 6 | # vim /etc/oratab 7 | # 8 | # 修改最后一行: N -> Y 9 | # 10 | # orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N 11 | # orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y 12 | # 13 | 14 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## centos 6.5 x64 install oracle 11g 4 | 5 | 6 | ### 1. 安装说明: 7 | 8 | - 安装环境要求: 9 | - 主机(可以是云主机)硬件配置: 10 | - CPU: 测试环境,要求不高. 生产环境, 尽量好点. 11 | - 内存: 12 | - 1G, 云主机测试, 可以勉强跑起来, 非常不推荐. 13 | - 2G+, 测试机, 够用. 14 | - 8G, 目前一台阿里云的生产环境. 15 | - 硬盘: 16 | - 尽量用 SSD, 数据库是 IO 瓶颈型. 17 | - 40G+, 测试机, 够用. 18 | - 500G, 生产环境云主机. 19 | - 目测业务开展起来远远不够 20 | - Oracle 的磁盘增长还是很快 21 | - 数据库日志增长也很快, 注意定期检查磁盘空间, 定期清理数据库日志 22 | - 磁盘不足时, 会导致服务挂掉.(遇到过一次) 23 | - 网络带宽: 24 | - 云主机, 只做数据库服务用, 可走内外 IP, 不需要公网带宽(1M 即可). 25 | - 尽量是走内网IP, 规划好多台云主机的功能. 26 | - OS 系统: centos 6.5 x64位, 内核 2.6 27 | - Oracle 版本: Oracle 11g 企业版 28 | - 支持云主机: 阿里云, 亚马逊 EC2 等 29 | 30 | 31 | 32 | 33 | ### 2. 概览: 34 | 35 | - oracle 11g 企业版: 36 | - 官方只提供 图形界面安装指引, 想通过命令行安装, 需要修改很多配置, 很容易失败. 37 | - 官方的安装包, 图形界面安装 支持 centos, 待测试 Ubuntu. 38 | - 网上可搜索到 oracle 11g xe 版本(注意不是企业版!) 的 非图形化界面 静默安装配置脚本, 个人尝试失败! 39 | - 非专业 Oracle DBA 很难搞明白那些修改参数的作用, 还是用 GUI 安装吧. 40 | - docker 镜像: 41 | - 可在 docker hub 上, 找到 oracle 11g xe 版本的 image, 42 | - 推荐学习者,不要尝试自己安装 Oracle 了.直接用 docker 镜像. 43 | - 但是生产环境, 用 XE 是不行的, 限制 数据库容量大小. 44 | - 云主机安装: 45 | - 云主机操作: 46 | - 安装 图形界面 47 | - 配置VNCserver 服务端服务. 48 | - 本地机器操作: 49 | - 通过 VNCserver 客户端, 连接云主机, 50 | - 使用图形界面来安装 Oracle11g 企业版 51 | - 之后的安装,配置步骤, 跟普通的图形界面安装,没有区别 52 | - 虽然到这里,已经容易很多, 但是后面依然有很多坑. 53 | - Oracle 11g 比 MysQL 难用太多, 建议除非迫不得已, 不要用 Oracle, 一生黑. 54 | 55 | 56 | ### 3. 安装指引: 57 | 58 | 59 | #### 3.1 安装 java8: 60 | 61 | - [参考: How To Install Java on CentOS and Fedora](https://www.digitalocean.com/community/tutorials/how-to-install-java-on-centos-and-fedora) 62 | 63 | 64 | #### 3.2 安装 VNCserver: 65 | 66 | ##### 参考文档: 67 | 68 | - [阿里云上CentOS的图形访问](http://www.jianshu.com/p/ad68f78f1419) 69 | - [CentOS6.5安装vncserver实现图形化访问](https://help.aliyun.com/knowledge_detail/5974462.html) 70 | - [Ubuntu安装vncserver实现图形化访问](https://help.aliyun.com/knowledge_detail/5974461.html) 71 | 72 | 73 | #### 3.2 添加中文字体支持: 74 | 75 | - 执行对应的 shell 脚本. 76 | 77 | 78 | 79 | #### 3.3 centos 转 redhat 欺骗脚本: 80 | - [Oracle 官网参考](https://linux.oracle.com/switch/centos/) 81 | - [参考](https://www.digitalocean.com/community/questions/how-can-i-install-oracle-11g) 82 | - 备注: 此 centos2ol.sh 脚本, 不建议使用, 经测试, 图形界面安装 Oracle 11g, 不需要执行此脚本. 83 | 84 | 85 | ``` 86 | 87 | # 欺骗脚本: 88 | curl -O https://linux.oracle.com/switch/centos2ol.sh 89 | sh centos2ol.sh 90 | 91 | # 安装 Oracle 依赖包: 92 | yum install oracle-rdbms-server-11gR2-preinstall -y 93 | 94 | 95 | ``` 96 | 97 | 98 | 99 | ### 4. 参考文档: 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Oracle11g/tips/oracle-cmd-tips.md: -------------------------------------------------------------------------------- 1 | 2 | ## oracle 常用命令: 3 | 4 | 5 | 6 | 7 | 8 | ```bash 9 | 10 | # 测试 连接成功: 11 | 12 | sqlplus / as sysdba; 13 | sqlplus posp/posp; 14 | sqlplus posp/posp as sysdba; 15 | 16 | 17 | startup 18 | quit; 19 | 20 | 21 | 22 | # 关闭数据库实例: 23 | su - oracle 24 | sqlplus /nolog 25 | conn /as sysdba 26 | 27 | shutdown immediate 28 | 29 | exit 30 | 31 | 32 | # 启动数据库实例: 33 | su - oracle 34 | sqlplus /nolog 35 | conn /as sysdba 36 | 37 | startup 38 | 39 | exit 40 | 41 | 42 | # 启动监听: 43 | lsnrctl start 44 | exit 45 | 46 | # 关闭监听: 47 | lsnrctl stop 48 | exit 49 | 50 | 51 | ``` 52 | 53 | 54 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Python/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 参考: 4 | 5 | 6 | - [stackoverflow](http://stackoverflow.com/questions/8087184/problems-installing-python3-on-rhel) 7 | 8 | 9 | ## 安装脚本说明: 10 | 11 | - 执行安装脚本: [install-python](./yum-install-python.sh) 12 | - 脚本安装: 13 | - 同时安装python2.7 和 python3.4 14 | - 同时安装 pip2 和 pip3 15 | - 支持 centos6.5 x64 和 7.x (默认注释掉,可打开) 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Python/yum-install-python.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | ############################################## 5 | # 说明: 6 | # 7 | # 1. 支持 阿里云 centos 6.5 x64 安装 8 | # 9 | # 10 | ############################################## 11 | 12 | sudo yum update -y 13 | sudo yum install https://centos6.iuscommunity.org/ius-release.rpm 14 | sudo yum update -y 15 | 16 | 17 | # search 18 | sudo yum search python2 19 | sudo yum search python3 20 | 21 | # python2.7 22 | sudo yum install -y python27 23 | 24 | # centos6.x - 64bit install python3.4 25 | sudo yum install -y python34u 26 | 27 | 28 | # download pip 29 | wget https://bootstrap.pypa.io/get-pip.py 30 | 31 | 32 | # install pip3 33 | python3.4 get-pip.py 34 | 35 | # install pip2 36 | python2.7 get-pip.py 37 | 38 | 39 | # check: 40 | 41 | pip2 --version 42 | 43 | pip3 --version 44 | 45 | 46 | 47 | # centos7.x install 48 | #sudo yum install epel-release 49 | #sudo yum install python34 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Tomcat/install-tomcat7.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # tomcat7 4 | sudo yum install -y tomcat 5 | 6 | 7 | -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/Tomcat/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## tomcat 安装: 4 | 5 | 6 | ### 参考: 7 | 8 | - [digitalocean 教程](https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-centos-7-via-yum) -------------------------------------------------------------------------------- /Linux/CentOS/6.5,6.8-x64/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## centos 6.x 64bit 说明: 5 | 6 | 7 | - 阿里云安装时,选择的是: centos 6.5 x64bit, 查看系统信息,却是 centos 6.8. 8 | - 估计 yum update 会升级版本? 9 | 10 | 11 | ### 查看系统信息: 12 | 13 | 14 | ```bash 15 | # 查看版本: 16 | lsb_release -a 17 | 18 | LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch 19 | Distributor ID: CentOS 20 | Description: CentOS release 6.8 (Final) 21 | Release: 6.8 22 | Codename: Final 23 | 24 | ``` 25 | 26 | 27 | 28 | ### 更改 centos 默认语言: 29 | 30 | ```bash 31 | echo $LANG 32 | LANG="en_US.UTF-8" 33 | logout 34 | 35 | ``` 36 | 37 | 38 | ### 更改 centos 源: 39 | - [参考163官网说明:](http://mirrors.163.com/.help/centos.html) 40 | 41 | -------------------------------------------------------------------------------- /Linux/CentOS/7.x-x64/docker/install-docker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | uname -r 5 | #3.10.0-123.el7.x86_64 6 | 7 | 8 | sudo yum update -y 9 | 10 | curl -fsSL https://get.docker.com/ | sh 11 | 12 | 13 | # 启动 daemon: 14 | sudo service docker start 15 | 16 | # 测试 hello-world: 17 | sudo docker run hello-world 18 | 19 | -------------------------------------------------------------------------------- /Linux/CentOS/7.x-x64/docker/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## centos7 安装 docker 4 | 5 | 6 | - [centos7-install-docker](https://docs.docker.com/engine/installation/linux/centos/) 7 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Docker/install-docker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # 国内镜像代理安装docker 5 | curl -sSL https://get.daocloud.io/docker | sh 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Docker/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 安装 docker 4 | 5 | - [daocloud 镜像安装 docker](https://get.daocloud.io/#install-docker) 6 | 7 | 8 | ``` 9 | curl -sSL https://get.daocloud.io/docker | sh 10 | 11 | ``` 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Git,SSH,Zsh,Tmux/install-git,zsh,tmux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################## 4 | # 说明: 5 | # - 系统重启后, 默认 shell 才会更改为 zsh 6 | # - zsh, 需要为每个用户单独设置, 一个个修改. 7 | # - oh-my-zsh插件,也需要为每个用户,单独下载安装. 8 | # 9 | ############################################## 10 | 11 | 12 | sudo apt-get update -y 13 | 14 | sudo apt-get install -y curl wget git 15 | sudo apt-get install -y vim 16 | sudo apt-get install -y zsh tmux 17 | 18 | # install oh-my-zsh 19 | cd ~ 20 | wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh 21 | 22 | # change default shell 23 | chsh -s /bin/zsh 24 | 25 | echo $SHELL 26 | 27 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Git,SSH,Zsh,Tmux/install-ssh.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #1. 确认ubuntu下已安装openssh-server 4 | sudo apt-get install -y openssh-server 5 | #sudo apt-get install -y ssh 6 | 7 | 8 | # 2.查看SSH服务是否打开. 9 | # 如果看到sshd说明ssh服务已经打开 10 | ps -e | grep ssh 11 | 12 | 13 | # 3.如无sshd服务,输入如下命令启动服务.再次输入上述命令查看. 14 | sudo /etc/init.d/ssh start 15 | 16 | 17 | # 4.输入ifconfig命令,查看虚拟机IP. 18 | # 回车显示: eth0 中 inet地址:172.16.2.132 即为虚拟机IP. 19 | ifconfig 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Java/install-java8.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # 安装 java8 5 | sudo apt-add-repository ppa:webupd8team/java -y 6 | sudo apt-get update 7 | sudo apt-get install oracle-java8-installer -y 8 | 9 | 10 | # 安装 Java environment variables 11 | sudo apt-get install oracle-java8-set-default 12 | 13 | 14 | # 查看版本: 15 | java -version 16 | 17 | #java version "1.8.0_91" 18 | #Java(TM) SE Runtime Environment (build 1.8.0_91-b14) 19 | #Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode) 20 | 21 | javac -version 22 | #javac 1.8.0_91 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/MongoDB/install-mongodb2.6.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 4 | 5 | sudo echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list 6 | sudo apt-get update -y 7 | 8 | 9 | # 安装: 10 | #sudo apt-get install -y mongodb-org 11 | 12 | sudo apt-get install -y \ 13 | mongodb-org=2.6.0 \ 14 | mongodb-org-server=2.6.0 \ 15 | mongodb-org-shell=2.6.0 \ 16 | mongodb-org-mongos=2.6.0 \ 17 | mongodb-org-tools=2.6.0 18 | 19 | 20 | # 查看版本: 21 | mongo --version 22 | 23 | #MongoDB shell version: 2.6.0 24 | 25 | 26 | # 启动服务: 27 | # sudo service mongod start 28 | 29 | # 关闭服务: 30 | # sudo service mongod stop 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/MongoDB/install-mongodb3.0.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Ubuntu 14.04 4 | # mongodb 3.0 5 | 6 | echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list 7 | 8 | sudo apt-get update -y 9 | sudo apt-get install -y --force-yes mongodb-org 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/MongoDB/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## unbuntu 安装 mongodb: 5 | 6 | ### 0. 参考: 7 | 8 | - [官方文档 - mongodb 2.6 安装 ](https://docs.mongodb.org/v2.6/tutorial/install-mongodb-on-ubuntu/) 9 | 10 | 11 | ### 1. 常用操作: 12 | 13 | - 连接测试: 14 | 15 | ``` 16 | 17 | $ mongo 18 | > db.test.save( { tecadmin: 100 } ) 19 | > db.test.find() 20 | 21 | 22 | ``` 23 | 24 | ### 2. 源码安装 mongodb 操作: 25 | 26 | #### 2.0 mongodb 在Ubuntu14.04 安装 27 | 28 | - 安装步骤,参考官方文档安装,没有问题的. 29 | - sudo mongo 查看数据库版本号 30 | - cat /etc/mongod.conf 查看配置文件. 31 | - 3.0版本,数据库默认存储路径: dbPath: /var/lib/mongodb 32 | 33 | 34 | #### 2.1 创建数据库默认存储目录 35 | 36 | ``` 37 | cd / 38 | sudo mkdir -p /data/db/ 39 | 40 | ``` 41 | 42 | #### 2.2 启动mongodb 43 | 44 | ``` 45 | 46 | # 启动后台服务 47 | cd /opt/mongodb/bin/ 48 | sudo ./mongod 49 | 50 | # 启动连接 51 | ./mongo 52 | 53 | # 查看mongodb 版本号 54 | db.version() 55 | 56 | ``` 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Nginx/install-nginx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sudo apt-get update -y 4 | 5 | # nginx 6 | sudo apt-get install -y nginx 7 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Nginx/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Nginx 说明: 4 | 5 | 6 | - 每次修改nginx配置文件,都应该测试是否配置有误 7 | 8 | 9 | ``` 10 | 11 | sudo nginx -t 12 | 13 | ``` 14 | 15 | 16 | - 重启 nginx 17 | 18 | ```bash 19 | 20 | sudo /etc/init.d/nginx restart 21 | 22 | ``` 23 | 24 | 25 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Python/install-python-by-src-code.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # Python 2.7.10: 5 | wget http://python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz 6 | tar xf Python-2.7.10.tar.xz 7 | cd Python-2.7.10 8 | ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" 9 | make && make altinstall 10 | 11 | 12 | 13 | # Python 3.4.3: 14 | wget http://python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz 15 | tar xf Python-3.4.3.tar.xz 16 | cd Python-3.4.3 17 | ./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" 18 | make && make altinstall 19 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Python/install-python.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # intstall python3, pip3 4 | sudo apt-get install -y python3.4 python3-pip 5 | 6 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Tomcat/install-tomcat-by-src-code.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 添加 tomcat 用户 4 | sudo groupadd tomcat 5 | 6 | sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat 7 | 8 | 9 | cd ~ 10 | 11 | wget http://mirror.sdunix.com/apache/tomcat/tomcat-8/v8.0.23/bin/apache-tomcat-8.0.23.tar.gz 12 | 13 | 14 | # 创建安装路径: 15 | sudo mkdir /opt/tomcat 16 | 17 | # 解压到安装路径: 18 | sudo tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1 19 | 20 | 21 | cd /opt/tomcat 22 | 23 | sudo chgrp -R tomcat conf 24 | sudo chmod g+rwx conf 25 | sudo chmod g+r conf/* 26 | 27 | sudo chown -R tomcat work/ temp/ logs/ 28 | 29 | 30 | sudo update-alternatives --config java 31 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/Tomcat/readme.md: -------------------------------------------------------------------------------- 1 | 2 | # Ubuntu14.04 安装 tomcat 3 | 4 | 5 | - [digitalocean - 文档](https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-14-04) 6 | 7 | 8 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/ffmpeg/install-ffmpeg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next 5 | sudo apt-get update -y 6 | 7 | # Installing FFmpeg 8 | sudo apt-get install -y ffmpeg 9 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/ffmpeg/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ## 参考工具 6 | 7 | - [m3u8-segmenter : github](https://github.com/johnf/m3u8-segmenter) 8 | - [m3u8-segmenter 官方文档](http://m3u8-segmenter.inodes.org/) 9 | 10 | 11 | ## ffmpeg 参数 12 | 13 | 14 | 15 | ``` 16 | 基本选项: 17 | -formats 输出所有可用格式 18 | -f fmt 指定格式(音频或视频格式) 19 | -i filename 指定输入文件名,在linux下当然也能指定:0.0(屏幕录制)或摄像头 20 | -y 覆盖已有文件 21 | -t duration 记录时长为t 22 | -fs limit_size 设置文件大小上限 23 | -ss time_off 从指定的时间(s)开始, [-]hh:mm:ss[.xxx]的格式也支持 24 | -itsoffset time_off 设置时间偏移(s),该选项影响所有后面的输入文件。该偏移被加到输入文件的时戳,定义一个正偏移意味着相应的流被延迟了 offset秒。 [-]hh:mm:ss[.xxx]的格式也支持 25 | -title string 标题 26 | -timestamp time 时间戳 27 | -author string 作者 28 | -copyright string 版权信息 29 | -comment string 评论 30 | -album string album名 31 | -v verbose 与log相关的 32 | -target type 设置目标文件类型("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd", "ntsc-svcd", ...) 33 | -dframes number 设置要记录的帧数 34 | 35 | 36 | 37 | 视频选项: 38 | -b 指定比特率(bits/s),似乎ffmpeg是自动VBR的,指定了就大概是平均比特率 39 | -vb 指定视频比特率(bits/s) 40 | -vframes number 设置转换多少桢(frame)的视频 41 | -r rate 桢速率(fps) 42 | -s size 分辨率 43 | -aspect aspect 设置视频长宽比(4:3, 16:9 or 1.3333, 1.7777) 44 | -croptop size 设置顶部切除尺寸(in pixels) 45 | -cropbottom size 设置底部切除尺寸(in pixels) 46 | -cropleft size 设置左切除尺寸 (in pixels) 47 | -cropright size 设置右切除尺寸 (in pixels) 48 | -padtop size 设置顶部补齐尺寸(in pixels) 49 | -padbottom size 底补齐(in pixels) 50 | -padleft size 左补齐(in pixels) 51 | -padright size 右补齐(in pixels) 52 | -padcolor color 补齐带颜色(000000-FFFFFF) 53 | -vn 取消视频 54 | -vcodec codec 强制使用codec编解码方式('copy' to copy stream) 55 | -sameq 使用同样视频质量作为源(VBR) 56 | -pass n 选择处理遍数(1或者2)。两遍编码非常有用。第一遍生成统计信息,第二遍生成精确的请求的码率 57 | -passlogfile file 选择两遍的纪录文件名为file 58 | -newvideo 在现在的视频流后面加入新的视频流 59 | 60 | 61 | 62 | 63 | 64 | 高级视频选项 65 | -pix_fmt format set pixel format, 'list' as argument shows all the pixel formats supported 66 | -intra 仅适用帧内编码 67 | -qscale q 以<数值>质量为基础的VBR,取值0.01-255,约小质量越好 68 | -loop_input 设置输入流的循环数(目前只对图像有效) 69 | -loop_output 设置输出视频的循环数,比如输出gif时设为0表示无限循环 70 | -g int 设置图像组大小 71 | -cutoff int 设置截止频率 72 | -qmin int 设定最小质量 73 | -qmax int 设定最大质量 74 | -qdiff int 量化标度间最大偏差 (VBR) 75 | -bf int 使用frames B 帧,支持mpeg1,mpeg2,mpeg4 76 | 77 | 78 | 79 | 音频选项: 80 | -ab 设置比特率(单位:bit/s,也许老版是kb/s) 81 | -aframes number 设置转换多少桢(frame)的音频 82 | -aq quality 设置音频质量 (指定编码) 83 | -ar rate 设置音频采样率 (单位:Hz) 84 | -ac channels 设置声道数 85 | -an 取消音频 86 | -acodec codec 指定音频编码('copy' to copy stream) 87 | -vol volume 设置录制音量大小(默认为256) 88 | -newaudio 在现在的音频流后面加入新的音频流 89 | 90 | 91 | 92 | 93 | 字幕选项: 94 | -sn 取消字幕 95 | -scodec codec 设置字幕编码('copy' to copy stream) 96 | -newsubtitle 在当前字幕后新增 97 | -slang code 设置字幕所用的ISO 639编码(3个字母) 98 | Audio/Video 抓取选项: 99 | -vc channel 设置视频捕获通道(只对DV1394) 100 | -tvstd standard 设置电视标准 NTSC PAL(SECAM) 101 | 102 | 103 | 104 | ``` 105 | 106 | 107 | 108 | 109 | 110 | 111 | ## ffmpeg 常用命令格式 112 | 113 | - [FFmpeg实用命令 ](http://davidaq.com/tutorial/2014/11/20/ffmpeg-commands.html) 114 | - [用ffmpeg 把mp4文件转为ts文件并生成m3u8列表](http://blog.csdn.net/jookers/article/details/21694957) 115 | - [生成 m3u8 - 视频切片方案](http://site.douban.com/180891/widget/notes/17846704/note/445146910/) 116 | 117 | ## 生成 m3u8 文件 118 | 119 | ``` 120 | 121 | ffmpeg -i input.mp4 -c:v libx264 -c:a aac -strict -2 -f hls output.m3u8 122 | 123 | ``` 124 | 125 | ## m3u8-segmenter 切割 ts 文件 126 | 127 | ``` 128 | 直接转成ts 129 | ffmpeg -i vp5.flv -acodec copy -vcodec libx264 vp5.ts 130 | 131 | 分割转成ts 一秒为单位 132 | ffmpeg -ss 0 -t 30 -i vp5.flv -acodec copy -vcodec libx264 1.ts 133 | ffmpeg -ss 30 -t 60 -i vp5.flv -acodec copy -vcodec libx264 2.ts 134 | 135 | 合并 136 | ffmpeg -i "concat:1.ts|2.ts" -acodec copy -vcodec copy -absf aac_adtstoasc output.mp4 137 | 138 | 切割 139 | m3u8-segmenter -i test.ts -d 10 -p segmenter_test -m test.m3u8 -u http://127.0.0.1:8080/Video/ 140 | 141 | ``` 142 | 143 | 144 | 145 | ## 音乐有损压缩 146 | 147 | 148 | ``` 149 | ffmpeg -i input.mp3 -ac 1 -ar 32k -bit_rate:a 128k output.mp3 150 | 151 | 152 | 上面命令做了三件事情: 153 | - -ac 1 指定只保留一个声道,所有声道都融合成一个(这里有个FFmpeg的bug,输出音量会变小)。 154 | 155 | - -ar 32k 表示采样率改为32000,通常的高保真音频都是48K左右,这个数值变小,会裁剪掉高音部分, 156 | 32K会裁掉不少高音,不过普通人如果没个对比,听不出什么问题。 157 | 如果音频文件不是音乐,而是人声内容(比如广播),则可以打手一挥设置成22k或16k(电话是16k) 158 | 159 | - -bit_rate:a 128k设置的时音频比特率,如果是-bit_rate:v就成了视频比特率,128K表示, 160 | 输出文件大概每秒钟的内容会有16KB左右的文件大小, 161 | 需要至少128kbps的网络才能流畅播放 128K算是比较理想的比特率,文件小,音频质量损失又不是特别明显(对于普通人) 162 | 163 | 164 | ``` 165 | 166 | 167 | 168 | ## 切割 169 | 170 | 171 | ``` 172 | 173 | ffmpeg -i test.mp4 -flags -global_header -f segment -segment_time 1 -segment_list ts/playlist.m3u8 -segment_list_type m3u8 -segment_format mpegts -map 0 -bsf h264_mp4toannexb -vcodec copy -acodec copy -y ts/media%05d.ts 174 | 175 | 176 | ffmpeg -i test.mp4 -flags -global_header -f segment -segment_time 1 -segment_list ./playlist.m3u8 -segment_list_type m3u8 -segment_format mpegts -map 0 -bsf h264_mp4toannexb -vcodec copy -acodec copy -y ./media%05d.ts 177 | 178 | 179 | ffmpeg -i 01.mp3 -flags -global_header -f segment -segment_time 10 -segment_list ./playlist.m3u8 -segment_list_type m3u8 -segment_format mpegts -map 0 -bsf h264_mp4toannexb -vcodec copy -acodec copy -y ./media%05d.ts 180 | 181 | 182 | ``` 183 | -------------------------------------------------------------------------------- /Linux/Ubuntu/14.04-x64/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## ubuntu 14.04 说明: 4 | 5 | 6 | ### 1. 国内镜像源: 7 | 8 | #### 1.1 查看系统信息.更改源,要特别注意版本 9 | 10 | ``` 11 | lsb_release -a 12 | 13 | # 输出提示信息: 14 | # No LSB modules are available. 15 | # Distributor ID: Ubuntu 16 | # Description: Ubuntu 14.04.3 LTS 17 | # Release: 14.04 18 | # Codename: trusty 19 | 20 | 21 | ``` 22 | #### 1.2 源列表: 23 | 24 | - [源列表](http://wiki.ubuntu.org.cn/%E6%BA%90%E5%88%97%E8%A1%A8) 25 | - 源对比: 26 | - 阿里云的源 27 | - 搜狐 28 | - 香港源: 大多数情况, 香港的源, 更好, 推荐 29 | 30 | #### 1.3 替换源: 31 | 32 | ``` 33 | # ubuntu 14 34 | sudo cp sources.list /etc/apt/ 35 | 36 | ``` 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Linux/apt-yum-mirrors/CentOS6-Base-163.repo: -------------------------------------------------------------------------------- 1 | # CentOS-Base.repo 2 | # 3 | # The mirror system uses the connecting IP address of the client and the 4 | # update status of each mirror to pick mirrors that are updated to and 5 | # geographically close to the client. You should use this for CentOS updates 6 | # unless you are manually picking other mirrors. 7 | # 8 | # If the mirrorlist= does not work for you, as a fall back you can try the 9 | # remarked out baseurl= line instead. 10 | # 11 | # 12 | 13 | [base] 14 | name=CentOS-$releasever - Base - 163.com 15 | baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/ 16 | #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os 17 | gpgcheck=1 18 | gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 19 | 20 | #released updates 21 | [updates] 22 | name=CentOS-$releasever - Updates - 163.com 23 | baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/ 24 | #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates 25 | gpgcheck=1 26 | gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 27 | 28 | #additional packages that may be useful 29 | [extras] 30 | name=CentOS-$releasever - Extras - 163.com 31 | baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/ 32 | #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras 33 | gpgcheck=1 34 | gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 35 | 36 | #additional packages that extend functionality of existing packages 37 | [centosplus] 38 | name=CentOS-$releasever - Plus - 163.com 39 | baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/ 40 | #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus 41 | gpgcheck=1 42 | enabled=0 43 | gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 44 | 45 | #contrib - packages by Centos Users 46 | [contrib] 47 | name=CentOS-$releasever - Contrib - 163.com 48 | baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/ 49 | #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib 50 | gpgcheck=1 51 | enabled=0 52 | gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 53 | -------------------------------------------------------------------------------- /Linux/apt-yum-mirrors/CentOS7-Base-163.repo: -------------------------------------------------------------------------------- 1 | # CentOS-Base.repo 2 | # 3 | # The mirror system uses the connecting IP address of the client and the 4 | # update status of each mirror to pick mirrors that are updated to and 5 | # geographically close to the client. You should use this for CentOS updates 6 | # unless you are manually picking other mirrors. 7 | # 8 | # If the mirrorlist= does not work for you, as a fall back you can try the 9 | # remarked out baseurl= line instead. 10 | # 11 | # 12 | [base] 13 | name=CentOS-$releasever - Base - 163.com 14 | #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os 15 | baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/ 16 | gpgcheck=1 17 | gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 18 | 19 | #released updates 20 | [updates] 21 | name=CentOS-$releasever - Updates - 163.com 22 | #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates 23 | baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/ 24 | gpgcheck=1 25 | gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 26 | 27 | #additional packages that may be useful 28 | [extras] 29 | name=CentOS-$releasever - Extras - 163.com 30 | #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras 31 | baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/ 32 | gpgcheck=1 33 | gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 34 | 35 | #additional packages that extend functionality of existing packages 36 | [centosplus] 37 | name=CentOS-$releasever - Plus - 163.com 38 | baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/ 39 | gpgcheck=1 40 | enabled=0 41 | gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 42 | -------------------------------------------------------------------------------- /Linux/apt-yum-mirrors/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 163 镜像源地址: 4 | 5 | - [网易开源镜像站](http://mirrors.163.com/) 6 | 7 | ### Ubuntu 替换默认源: 8 | 9 | - [Ubuntu镜像使用帮助](http://mirrors.163.com/.help/ubuntu.html) 10 | - 以Wily(15.10)为例, 编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份) 11 | - 或者下载相应版本的 sources.list, 覆盖/etc/apt/sources.list即可(操作前请做好相应备份) 12 | - 版本对应: 13 | - lucid(10.04) 14 | - precise(12.04) 15 | - trusty(14.04) 16 | - utopic(14.10) 17 | - vivid(15.04) 18 | - wily(15.10) 19 | 20 | 21 | 22 | ``` 23 | 24 | deb http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse 25 | deb http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse 26 | deb http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse 27 | deb http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse 28 | deb http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse 29 | deb-src http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse 30 | deb-src http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse 31 | deb-src http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse 32 | deb-src http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse 33 | deb-src http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse 34 | 35 | 36 | ``` 37 | 38 | 39 | ### centos 替换默认源: 40 | 41 | - [CentOS镜像使用帮助](http://mirrors.163.com/.help/centos.html) 42 | 43 | 44 | - 首先备份/etc/yum.repos.d/CentOS-Base.repo 45 | 46 | ```bash 47 | mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 48 | 49 | ``` 50 | 51 | 52 | - 下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份) 53 | - CentOS7 54 | - CentOS6 55 | - CentOS5 56 | 57 | - 运行以下命令生成缓存 58 | 59 | ```bash 60 | 61 | yum clean all 62 | yum makecache 63 | 64 | ``` 65 | -------------------------------------------------------------------------------- /Linux/apt-yum-mirrors/sources.list.trusty: -------------------------------------------------------------------------------- 1 | deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse 2 | deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse 3 | deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse 4 | deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse 5 | deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse 6 | deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse 7 | deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse 8 | deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse 9 | deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse 10 | deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse 11 | -------------------------------------------------------------------------------- /MacOSX/Go/brew-install-glide.sh: -------------------------------------------------------------------------------- 1 | 2 | 3 | # install 4 | brew install glide 5 | -------------------------------------------------------------------------------- /MacOSX/Go/brew-install-go.sh: -------------------------------------------------------------------------------- 1 | 2 | # install go: 3 | brew install go 4 | 5 | 6 | -------------------------------------------------------------------------------- /MacOSX/Go/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 关于 go 安装说明: 4 | 5 | 6 | ## 开发环境搭建: 7 | 8 | - [go 安装官方文档](https://golang.org/doc/install) 9 | - 必看, 此文档非常详细. 10 | 11 | 12 | ### Mac osx 开发环境配置: 13 | 14 | 15 | - go 安装: 16 | - 使用 homebrew 方式, 参看脚本. 17 | - 配置 go 环境变量: (必要步骤) 18 | - go 安装路径 19 | - go 用户代码空间路径 20 | 21 | - go 开发工具推荐: 22 | - IDEA ( jb 家的 IDE 全套都可以通过插件来支持 go, 但 idea 支持最佳) 23 | - sublime text3 24 | 25 | 26 | ### Linux 和 Windows 开发环境配置: 27 | 28 | - go 安装: 29 | - 下载安装包, 或者编译源码安装 30 | - 配置 go 环境变量: 31 | - 同上 32 | - 开发工具: 33 | - 同上 34 | 35 | 36 | ## go 重要包介绍: 37 | 38 | ### go 包管理工具: 39 | 40 | - [glide](https://github.com/Masterminds/glide) 41 | - 项目说明, 有安装提示和使用方法说明 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /MacOSX/Jenkins/install-jenkins-log.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | -> % brew install jenkins 4 | 5 | ==> Downloading http://mirrors.jenkins-ci.org/war/2.15/jenkins.war 6 | ==> Downloading from http://ftp-nyc.osuosl.org/pub/jenkins/war/2.15/jenkins.war 7 | ######################################################################## 100.0% 8 | ==> jar xvf jenkins.war 9 | ==> Caveats 10 | Note: When using launchctl the port will be 8080. 11 | 12 | To restart jenkins after an upgrade: 13 | brew services restart jenkins 14 | 15 | Or, if you don't want/need a background service you can just run: 16 | jenkins 17 | 18 | ==> Summary 19 | 🍺 /usr/local/Cellar/jenkins/2.15: 6 files, 66.4M, built in 19 seconds -------------------------------------------------------------------------------- /MacOSX/Jenkins/install-jenkins.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | brew install jenkins 5 | -------------------------------------------------------------------------------- /MacOSX/MongoDB/install-mongodb-log.txt: -------------------------------------------------------------------------------- 1 | 2 | # 安装日志: 3 | 4 | -> % brew install mongodb 5 | ==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.2.8.el_capitan.bottle.tar.gz 6 | ######################################################################## 100.0% 7 | ==> Pouring mongodb-3.2.8.el_capitan.bottle.tar.gz 8 | ==> Caveats 9 | 10 | To restart mongodb after an upgrade: 11 | brew services restart mongodb 12 | 13 | Or, if you don't want/need a background service you can just run: 14 | mongod --config /usr/local/etc/mongod.conf 15 | 16 | ==> Summary 17 | 🍺 /usr/local/Cellar/mongodb/3.2.8: 17 files, 264.1M -------------------------------------------------------------------------------- /MacOSX/MongoDB/install-mongodb.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | 5 | brew search mongodb 6 | 7 | 8 | # 安装3.0版本 9 | brew install mongodb 10 | 11 | # 安装2.6版本 12 | # brew install mongodb26 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /MacOSX/MongoDB/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 安装 Mongodb 4 | 5 | ### 1. 参考: 6 | 7 | - [官方文档参考:](https://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/) 8 | 9 | 10 | 1. 如果用mongodb的GUI工具, 只支持 mongodb2.6 11 | 2. 如果用pycharm的插件,使用mongo,就可以装3.0 12 | 13 | 14 | ### 2. 关于启动方式说明: 15 | 16 | - 设置开启启动: 17 | - ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents 18 | - launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist 19 | 20 | - 普通后台启动: 21 | - mongod --config /usr/local/etc/mongod.conf 22 | 23 | ### 3. homebrew方式安装,默认的 数据库 存储目录: 24 | 25 | - dbPath: /usr/local/var/mongodb 26 | 27 | ``` 28 | cat mongod.conf 29 | 30 | 31 | systemLog: 32 | destination: file 33 | path: /usr/local/var/log/mongodb/mongo.log 34 | logAppend: true 35 | storage: 36 | dbPath: /usr/local/var/mongodb 37 | net: 38 | bindIp: 127.0.0.1 39 | 40 | 41 | ``` 42 | 43 | 44 | 45 | ### 4. 安装日志: 46 | 47 | ``` 48 | ➜ ~ brew install mongodb 49 | 50 | ==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.0.7.el_capitan.bottle.tar.gz 51 | ######################################################################## 100.0% 52 | ==> Pouring mongodb-3.0.7.el_capitan.bottle.tar.gz 53 | ==> Caveats 54 | 55 | To have launchd start mongodb at login: 56 | ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents 57 | Then to load mongodb now: 58 | launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist 59 | 60 | 61 | Or, if you don't want/need launchctl, you can just run: 62 | mongod --config /usr/local/etc/mongod.conf 63 | ==> Summary 64 | 🍺 /usr/local/Cellar/mongodb/3.0.7: 17 files, 158M 65 | ➜ ~ 66 | 67 | 68 | ``` -------------------------------------------------------------------------------- /MacOSX/MySQL/init-mysql-step.txt: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 初始化说明: 3 | # - 执行 brew install mysql, 下一步, 就是根据提示, 执行本脚本命令. 4 | # - 根据提示, 一步步往下走. 5 | # - 结束之后, 登录 MySQL 验证: mysql -uroot -p 6 | # 7 | ###################################################################### 8 | 9 | 10 | -> % mysql_secure_installation 11 | 12 | mysql_secure_installation: [ERROR] unknown variable 'default-character-set=utf8' 13 | 14 | Securing the MySQL server deployment. 15 | 16 | Enter password for user root: < 输入 root > 17 | 18 | VALIDATE PASSWORD PLUGIN can be used to test passwords 19 | and improve security. It checks the strength of password 20 | and allows the users to set only those passwords which are 21 | secure enough. Would you like to setup VALIDATE PASSWORD plugin? 22 | 23 | Press y|Y for Yes, any other key for No: y 24 | The password validation plugin is not available. Proceeding with the further steps without the plugin. 25 | Using existing password for root. 26 | Change the password for root ? ((Press y|Y for Yes, any other key for No) : y < 输入 > 27 | 28 | New password: <输入: 123456> 29 | 30 | Re-enter new password: <输入: 123456> 31 | By default, a MySQL installation has an anonymous user, 32 | allowing anyone to log into MySQL without having to have 33 | a user account created for them. This is intended only for 34 | testing, and to make the installation go a bit smoother. 35 | You should remove them before moving into a production 36 | environment. 37 | 38 | Remove anonymous users? (Press y|Y for Yes, any other key for No) : y < 输入 > 39 | Success. 40 | 41 | 42 | Normally, root should only be allowed to connect from 43 | 'localhost'. This ensures that someone cannot guess at 44 | the root password from the network. 45 | 46 | Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y < 输入 > 47 | Success. 48 | 49 | By default, MySQL comes with a database named 'test' that 50 | anyone can access. This is also intended only for testing, 51 | and should be removed before moving into a production 52 | environment. 53 | 54 | 55 | Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n < 输入 > 56 | 57 | ... skipping. 58 | Reloading the privilege tables will ensure that all changes 59 | made so far will take effect immediately. 60 | 61 | 62 | 63 | Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y < 输入 > 64 | Success. 65 | 66 | All done! 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /MacOSX/MySQL/install-mysql-log.txt: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 安装说明: 3 | # - 执行 brew install mysql 安装 4 | # - 安装完, 下一步, 执行: mysql_secure_installation 5 | # - 参考 init-mysql-step.txt 里每一步输入提示, 往下初始化. 6 | # 7 | ###################################################################### 8 | 9 | 10 | -> % brew install mysql 11 | 12 | ==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.13.el_capitan.bottle.tar.gz 13 | ######################################################################## 100.0% 14 | ==> Pouring mysql-5.7.13.el_capitan.bottle.tar.gz 15 | ==> Caveats 16 | We've installed your MySQL database without a root password. To secure it run: 17 | mysql_secure_installation 18 | 19 | To connect run: 20 | mysql -uroot 21 | mysql -uroot -p <带密码> 22 | 23 | To start mysql: 24 | brew services start mysql 25 | Or, if you don't want/need a background service you can just run: 26 | mysql.server start 27 | ==> Summary 28 | 🍺 /usr/local/Cellar/mysql/5.7.13: 13,344 files, 445.0M -------------------------------------------------------------------------------- /MacOSX/MySQL/install-mysql.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | brew install mysql 5 | 6 | 7 | 8 | brew info mysql 9 | 10 | 11 | 12 | # start: 13 | mysql.server start 14 | 15 | # restart: 16 | mysql.server restart 17 | 18 | # stop: 19 | mysql.server stop 20 | 21 | 22 | 23 | # 登录, 输入密码方式: 24 | mysql -uroot -p 25 | 26 | 27 | 28 | 29 | # error-fix: 30 | # error: Table 'performance_schema.session_variables' doesn't exist 31 | mysql_upgrade -u root -p --force 32 | mysql.server restart 33 | 34 | -------------------------------------------------------------------------------- /MacOSX/MySQL/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # MySQL 说明: 4 | 5 | ## MySQL 配置: 6 | 7 | ``` 8 | # 9 | # 配置路径: 10 | # - MySQL 数据库存放路径 11 | # - pid 文件, log 文件 12 | # 13 | /usr/local/var/mysql 14 | 15 | 16 | 17 | ``` 18 | 19 | 20 | ## MySQL 启动, 登录, 退出: 21 | 22 | 23 | ``` 24 | # 后台进程,启动 mysqld 25 | mysqld 26 | 27 | # 前台进程,启动 mysqld 28 | mysql.server start 29 | 30 | # 前台,重启: 31 | mysql.server restart 32 | 33 | # 前台,退出: 34 | mysql.server stop 35 | 36 | 37 | 38 | # 连接数据库: 39 | mysql -uroot -p 40 | 41 | 42 | 43 | ``` 44 | 45 | 46 | 47 | ## 常用 SQL 操作: 48 | 49 | ```bash 50 | 51 | 52 | 53 | # 显示所有数据库: 54 | mysql> show databases; 55 | 56 | 57 | # 选择使用 XX 数据库: 58 | mysql> use xxx-database; 59 | 60 | 61 | # 显示数据库里的表: 62 | mysql> show tables; 63 | 64 | 65 | # 创建数据库 66 | mysql> create database xxx-database; 67 | 68 | 69 | # 执行 sql 文件 70 | mysql> source /sql/file/path/xxx.sql; 71 | 72 | 73 | # 退出 74 | mysql> quit; 75 | 76 | 77 | 78 | 79 | 80 | ``` 81 | 82 | 83 | 84 | ## 问题解决: 85 | 86 | 87 | - [Table 'performance_schema.session_variables' doesn't exist](http://stackoverflow.com/questions/31967527/table-performance-schema-session-variables-doesnt-exist) -------------------------------------------------------------------------------- /MacOSX/Nginx/install-nginx-log.txt: -------------------------------------------------------------------------------- 1 | 2 | -> % brew install nginx 3 | 4 | ==> Installing dependencies for nginx: pcre 5 | ==> Installing nginx dependency: pcre 6 | ==> Downloading https://homebrew.bintray.com/bottles/pcre-8.39.el_capitan.bottle.tar.gz 7 | ######################################################################## 100.0% 8 | ==> Pouring pcre-8.39.el_capitan.bottle.tar.gz 9 | 🍺 /usr/local/Cellar/pcre/8.39: 203 files, 5.4M 10 | ==> Installing nginx 11 | ==> Downloading https://homebrew.bintray.com/bottles/nginx-1.10.1.el_capitan.bottle.tar.gz 12 | ######################################################################## 100.0% 13 | ==> Pouring nginx-1.10.1.el_capitan.bottle.tar.gz 14 | ==> Caveats 15 | Docroot is: /usr/local/var/www 16 | 17 | The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that 18 | nginx can run without sudo. 19 | 20 | nginx will load all files in /usr/local/etc/nginx/servers/. 21 | 22 | To restart nginx after an upgrade: 23 | brew services restart nginx 24 | 25 | Or, if you don't want/need a background service you can just run: 26 | nginx 27 | 28 | ==> Summary 29 | 🍺 /usr/local/Cellar/nginx/1.10.1: 7 files, 972.2K -------------------------------------------------------------------------------- /MacOSX/Nginx/install-nginx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | sudo brew update 5 | brew install nginx 6 | 7 | 8 | nginx -v 9 | # nginx version: nginx/1.8.0 10 | 11 | 12 | # 配置: 13 | # cd /usr/local/etc/nginx 14 | 15 | 16 | # 停止: 17 | # sudo nginx -s quit -------------------------------------------------------------------------------- /MacOSX/Nginx/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Nginx 说明: 4 | 5 | ### 1. 配置说明: 6 | 7 | ``` 8 | 9 | /usr/local/etc/nginx/servers 10 | 11 | # 配置: 12 | cd /usr/local/etc/nginx 13 | 14 | 15 | # 停止: 16 | sudo nginx -s quit 17 | 18 | ``` 19 | 20 | ### 2. homebrew 安装日志: 21 | 22 | ``` 23 | 24 | ==> Pouring nginx-1.8.0.el_capitan.bottle.1.tar.gz 25 | ==> Caveats 26 | Docroot is: /usr/local/var/www 27 | 28 | The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that 29 | nginx can run without sudo. 30 | 31 | nginx will load all files in /usr/local/etc/nginx/servers/. 32 | 33 | To have launchd start nginx at login: 34 | ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents 35 | Then to load nginx now: 36 | launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist 37 | Or, if you don't want/need launchctl, you can just run: 38 | nginx 39 | ==> Summary 40 | 41 | ``` 42 | 43 | -------------------------------------------------------------------------------- /MacOSX/Nodejs/brew-install.sh: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Build with full-icu (all locales) instead of small-icu (English only) 4 | # brew install node --with-full-icu 5 | 6 | brew install node 7 | 8 | brew link node 9 | 10 | # v7.1.0 11 | node -v 12 | 13 | 14 | -------------------------------------------------------------------------------- /MacOSX/Nodejs/cnpm-install.sh: -------------------------------------------------------------------------------- 1 | # global install: 2 | 3 | cnpm install -g webpack 4 | cnpm install -g 5 | 6 | # lib: 7 | cnpm install -g vue-cli 8 | cnpm install -g weex-toolkit 9 | cnpm install -g react-native-cli 10 | 11 | cnpm install -g marked 12 | 13 | 14 | # check es: 15 | cnpm install -g eslint 16 | 17 | # tool: 18 | cnpm install -g grunt-cli 19 | cnpm install -g webpack 20 | cnpm install -g webpack-dev-server 21 | 22 | 23 | # check version: 24 | grunt --version 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /MacOSX/Nodejs/npm-install-cnpm.sh: -------------------------------------------------------------------------------- 1 | 2 | # 使用 taobao 的 cnpm 替代 npm 工具 3 | # 淘宝源: https://npm.taobao.org/ 4 | npm install -g cnpm --registry=https://registry.npm.taobao.org 5 | 6 | # version: 4.4.0 7 | cnpm -v 8 | 9 | -------------------------------------------------------------------------------- /MacOSX/Nodejs/uninstall.sh: -------------------------------------------------------------------------------- 1 | 2 | ########################## 3 | # uninstall nodejs 4 | ########################## 5 | 6 | 7 | 8 | 9 | # first: 10 | lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done 11 | sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* 12 | 13 | # To recap, the best way (I've found) to completely uninstall node + npm is to do the following: 14 | 15 | # go to /usr/local/lib and delete any node and node_modules 16 | cd /usr/local/lib 17 | sudo rm -rf node* 18 | 19 | # go to /usr/local/include and delete any node and node_modules directory 20 | cd /usr/local/include 21 | sudo rm -rf node* 22 | 23 | # if you installed with brew install node, then run brew uninstall node in your terminal 24 | brew uninstall node 25 | 26 | # check your Home directory for any "local" or "lib" or "include" folders, and delete any "node" or "node_modules" from there 27 | # go to /usr/local/bin and delete any node executable 28 | cd /usr/local/bin 29 | sudo rm -rf /usr/local/bin/npm 30 | sudo rm -rf /usr/local/bin/node 31 | ls -las 32 | 33 | # you may need to do the additional instructions as well: 34 | sudo rm -rf /usr/local/share/man/man1/node.1 35 | sudo rm -rf /usr/local/lib/dtrace/node.d 36 | sudo rm -rf ~/.npm -------------------------------------------------------------------------------- /MacOSX/OsxFix/fix-open-way-issue.sh: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 问题: 4 | # - Mac 文件的右键, 打开方式里有重复无效的打开方式. 5 | # - 关键点: 重启所有的 Finder. 6 | 7 | /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch" 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MacOSX/PostgreSQL/uninstall.sh: -------------------------------------------------------------------------------- 1 | 2 | # help: 3 | # https://gist.github.com/Atlas7/b1a40a2ffd85728b33e7 4 | 5 | 6 | # installed PostgreSQL with homebrew: 7 | brew uninstall postgresql 8 | 9 | 10 | # installed with Postgres Installer: 11 | # do: 12 | open /Library/PostgreSQL/9.4/uninstall-postgresql.app 13 | 14 | # see: 15 | # The data directory (/Library/PostgreSQL/9.4/data) 16 | # and service user account (postgres) 17 | # have not been removed. 18 | 19 | # yes: 20 | # Uninstallation completed 21 | 22 | # Remove the PostgreSQL and data folders. 23 | sudo rm -rf /Library/PostgreSQL 24 | 25 | # Remove the ini file: 26 | sudo rm /etc/postgres-reg.ini 27 | 28 | # Remove the PostgreSQL user 29 | # using System Preferences -> Users & Groups. 30 | 31 | # Restore your shared memory settings: 32 | sudo rm /etc/sysctl.conf 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /MacOSX/Python/brew-install-pyenv.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ########################################################## 4 | # 脚本文件 5 | # 说明: 6 | # - 1. 本脚本包含 pyenv, pyenv-virtualenv 安装配置步骤 7 | # - 2. 请仔细阅读每条命令作用, 不要直接执行本脚本. 8 | # - 3. 包含 zsh, bash 配置文件的修改. 9 | # - 4. 包含 pyenv 具体操作命令 10 | # 11 | # 参考: 12 | # - https://github.com/yyuu/pyenv#homebrew-on-mac-os-x 13 | # - https://github.com/yyuu/pyenv-virtualenv 14 | # 15 | ########################################################## 16 | 17 | 18 | # 安装: 19 | brew install pyenv 20 | brew install pyenv-virtualenv 21 | 22 | 23 | 24 | # 升级: 25 | brew upgrade pyenv 26 | brew upgrade pyenv-virtualenv 27 | 28 | 29 | 30 | # 查看版本已过期软件: 31 | brew outdated 32 | 33 | 34 | # 查看可以安装的 Python 版本列表: 35 | # pyenv install --list 36 | 37 | # 过滤可以安装的 Python 版本列表: 38 | pyenv install --list | grep 2.7. 39 | pyenv install --list | grep 3.4. 40 | pyenv install --list | grep 3.5. 41 | 42 | 43 | # 自动列出所有版本的小版本: 44 | # pyenv install 2.7. 45 | # pyenv install 3.4. 46 | 47 | # 安装 Python2.7: 48 | pyenv install 2.7.12 49 | 50 | # 安装 Python 3.4.5: 51 | pyenv install 3.4.5 52 | 53 | # 安装 Python 3.5.2: 54 | pyenv install 3.5.2 55 | 56 | 57 | 58 | # 查看已安装python版本: 59 | pyenv versions 60 | 61 | 62 | 63 | # 64 | # 必要步骤: 初始化命令添加到 shell-profile: 65 | # - https://github.com/yyuu/pyenv-virtualenv 参考说明. 66 | # - 如下2条命令,写入 shell 配置后, 每次进入到含有.python-version的目录, 会自动激活 虚拟环境 67 | # - 离开含义.python-version的目录, 会自动退出虚拟环境. 68 | # 69 | # 70 | 71 | 72 | # 关于 zsh 配置文件的说明: 73 | # http://zsh.sourceforge.net/Intro/intro_3.html 74 | # 75 | #There are five startup files that zsh will read commands from: 76 | #$ZDOTDIR/.zshenv 77 | #$ZDOTDIR/.zprofile 78 | #$ZDOTDIR/.zshrc 79 | #$ZDOTDIR/.zlogin 80 | #$ZDOTDIR/.zlogout 81 | 82 | # 83 | # 将初始化命令, 写入 zsh 配置文件(~/.zprofile, 不是 ~/zsh_profile): 84 | echo 'eval "$(pyenv init -)"' >> ~/.zprofile 85 | echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zprofile 86 | 87 | 88 | # 将初始化命令, 写入 bash 配置文件(.bash_profile): 89 | echo 'eval "$(pyenv init -)"' >> ~/.bash_profile 90 | echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile 91 | 92 | 93 | 94 | # 95 | # pyenv init 96 | # Load pyenv automatically by appending 97 | # the following to ~/.zshrc: 98 | # 99 | # eval "$(pyenv init -)" 100 | # 101 | 102 | 103 | 104 | # 105 | # * system (set by /Users/hhstore/.pyenv/version) 106 | # 2.7.12 107 | # 3.4.5 108 | # 3.5.2 109 | # 110 | # 111 | # 默认使用 pyenv 安装 python 的存储路径: 112 | # ~/.pyenv/versions 113 | # 114 | 115 | 116 | 117 | # 切换全局默认版本: 118 | pyenv global system 119 | 120 | # 将当前项目路径下的 Python 环境设置为 指定版本: 121 | pyenv local 2.7.12 122 | 123 | # 查看当前项目路径下 python 指定版本: 124 | pyenv version 125 | python --version 126 | 127 | 128 | 129 | # 卸载某个版本: 130 | # pyenv uninstall x.x.x 131 | 132 | 133 | # 创建虚拟机环境: 134 | pyenv virtualenv 2.7.12 vpyenv27-app1 135 | pyenv virtualenv 3.4.5 vpyenv34-app1 136 | 137 | 138 | 139 | # 查看虚拟环境列表: 140 | pyenv virtualenvs 141 | 142 | # 激活虚拟环境: 143 | pyenv activate vpyenv27-app1 144 | 145 | # 退出虚拟环境: 146 | pyenv deactivate 147 | 148 | # 删除虚拟环境: 149 | rm -rf ~/.pyenv/versions/vpyenv27-xxx 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /MacOSX/Python/readme.md: -------------------------------------------------------------------------------- 1 | 2 | # 关于 Mac 版本的 Python 安装说明: 3 | 4 | - Mac 系统自带 python2.6 5 | - 使用 Python 开发,摆脱不了同时面对 python2.7, 3.4, 3.5 等版本. 6 | - 强烈`不建议`用 brew 安装 python 各版本, 使用上会出一些小问题. 7 | - 推荐去 [Python 官网](https://www.python.org/downloads/) 下载 64位安装包来安装. 8 | 9 | 10 | ## Python 多版本管理-`最佳实践`: 11 | 12 | 1. Python 官网下载Python2.7(或Python3.x) 版本的 64位安装包.(只需要下一个) 13 | 2. 安装 pip.(似乎官网下载的安装包,自带 pip) 14 | 3. 通过 brew 安装 `pyenv`. 15 | 4. 通过 brew 安装 `pyenv-virtualenv`. 16 | 5. 通过 pyenv 配合 pyenv-virtualenv, 来安装 python2.7, python3.4等各版本. 17 | 6. 通过 pyenv-virtualenv 创建各项目的虚拟环境, 统一管理. 18 | 7. pyenv + pyenv-virtualenv 有很多优点,目前看比 `zc.buildout`要方便. 19 | 20 | 21 | ```bash 22 | 23 | # 安装: 24 | # 其他使用命令参考: brew-install-pyenv.sh 脚本 25 | brew install pyenv 26 | brew install pyenv-virtualenv 27 | 28 | 29 | ``` 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /MacOSX/RabbitMQ/install-rabbitmq-log.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # 安装 rabbitmq: 4 | # 依赖: erlang 5 | # 6 | 7 | -> % brew install rabbitmq 8 | 9 | ==> Installing dependencies for rabbitmq: xz, jpeg, libpng, libtiff, wxmac, erlang 10 | ==> Installing rabbitmq dependency: xz 11 | ==> Downloading https://homebrew.bintray.com/bottles/xz-5.2.2.el_capitan.bottle.tar.gz 12 | ######################################################################## 100.0% 13 | ==> Pouring xz-5.2.2.el_capitan.bottle.tar.gz 14 | 🍺 /usr/local/Cellar/xz/5.2.2: 91 files, 1.4M 15 | ==> Installing rabbitmq dependency: jpeg 16 | ==> Downloading https://homebrew.bintray.com/bottles/jpeg-8d.el_capitan.bottle.2.tar.gz 17 | ######################################################################## 100.0% 18 | ==> Pouring jpeg-8d.el_capitan.bottle.2.tar.gz 19 | 🍺 /usr/local/Cellar/jpeg/8d: 19 files, 713.7K 20 | ==> Installing rabbitmq dependency: libpng 21 | ==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.23.el_capitan.bottle.tar.gz 22 | ######################################################################## 100.0% 23 | ==> Pouring libpng-1.6.23.el_capitan.bottle.tar.gz 24 | 🍺 /usr/local/Cellar/libpng/1.6.23: 25 files, 1.2M 25 | ==> Installing rabbitmq dependency: libtiff 26 | ==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.6_2.el_capitan.bottle.tar.gz 27 | ######################################################################## 100.0% 28 | ==> Pouring libtiff-4.0.6_2.el_capitan.bottle.tar.gz 29 | 🍺 /usr/local/Cellar/libtiff/4.0.6_2: 261 files, 3.4M 30 | ==> Installing rabbitmq dependency: wxmac 31 | ==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.2_2.el_capitan.bottle.1.tar.gz 32 | ######################################################################## 100.0% 33 | ==> Pouring wxmac-3.0.2_2.el_capitan.bottle.1.tar.gz 34 | 🍺 /usr/local/Cellar/wxmac/3.0.2_2: 809 files, 23.6M 35 | ==> Installing rabbitmq dependency: erlang 36 | ==> Downloading https://homebrew.bintray.com/bottles/erlang-19.0.2.el_capitan.bottle.tar.gz 37 | ######################################################################## 100.0% 38 | ==> Pouring erlang-19.0.2.el_capitan.bottle.tar.gz 39 | ==> Caveats 40 | 41 | Man pages can be found in: 42 | /usr/local/opt/erlang/lib/erlang/man 43 | 44 | Access them with `erl -man`, or add this directory to MANPATH. 45 | ==> Summary 46 | 🍺 /usr/local/Cellar/erlang/19.0.2: 7,292 files, 278.6M 47 | 48 | # 安装rabbitmq: 49 | 50 | ==> Installing rabbitmq 51 | ==> Downloading https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.3/rabbitmq-server-generic-unix-3.6 52 | ######################################################################## 100.0% 53 | ==> /usr/bin/unzip -qq -j /usr/local/Cellar/rabbitmq/3.6.3/plugins/rabbitmq_management-3.6.3.ez rabbitmq_ 54 | ==> Caveats 55 | Management Plugin enabled by default at http://localhost:15672 56 | 57 | Bash completion has been installed to: 58 | /usr/local/etc/bash_completion.d 59 | 60 | To restart rabbitmq after an upgrade: 61 | brew services restart rabbitmq 62 | 63 | Or, if you don't want/need a background service you can just run: 64 | rabbitmq-server 65 | 66 | ==> Summary 67 | 🍺 /usr/local/Cellar/rabbitmq/3.6.3: 186 files, 5.8M, built in 20 seconds 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /MacOSX/RabbitMQ/install-rabbitmq.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | brew update 4 | brew install rabbitmq 5 | -------------------------------------------------------------------------------- /MacOSX/RabbitMQ/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## rabbitmq 说明: 4 | 5 | 6 | - [官方安装文档](https://www.rabbitmq.com/install-homebrew.html) 7 | - 包含安装,启动,配置等说明 8 | 9 | -------------------------------------------------------------------------------- /MacOSX/Redis/install-redis-log.txt: -------------------------------------------------------------------------------- 1 | 2 | # 安装日志: 3 | 4 | -> % brew install redis 5 | ==> Downloading https://homebrew.bintray.com/bottles/redis-3.2.1.el_capitan.bottle.tar.gz 6 | ######################################################################## 100.0% 7 | ==> Pouring redis-3.2.1.el_capitan.bottle.tar.gz 8 | ==> Caveats 9 | 10 | To have launchd start redis now and restart at login: 11 | brew services start redis 12 | 13 | Or, if you don't want/need a background service you can just run: 14 | redis-server /usr/local/etc/redis.conf 15 | 16 | ==> Summary 17 | 🍺 /usr/local/Cellar/redis/3.2.1: 10 files, 1.7M -------------------------------------------------------------------------------- /MacOSX/Redis/install-redis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sudo xcodebuild -license 4 | 5 | sudo brew update 6 | brew install redis 7 | -------------------------------------------------------------------------------- /MacOSX/Tomcat/install-tomcat-log.txt: -------------------------------------------------------------------------------- 1 | 2 | -> % brew install tomcat 3 | ==> Downloading https://www.apache.org/dyn/closer.cgi?path=tomcat/tomcat-8/v8.5.4/bin/apache-tomcat-8.5.4 4 | ==> Best Mirror http://apache.mirrors.pair.com/tomcat/tomcat-8/v8.5.4/bin/apache-tomcat-8.5.4.tar.gz 5 | ######################################################################## 100.0% 6 | 🍺 /usr/local/Cellar/tomcat/8.5.4: 632 files, 12.3M, built in 10 seconds -------------------------------------------------------------------------------- /MacOSX/Tomcat/install-tomcat7.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 安装 tomcat8: 4 | # 路径: /usr/local/Cellar/tomcat/8.5.4 5 | brew install tomcat 6 | 7 | 8 | # 安装 tomcat7: 9 | brew install tomcat7 10 | 11 | -------------------------------------------------------------------------------- /MacOSX/Vim/install-vim-log.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -> % brew install vim 5 | ==> Installing dependencies for vim: perl, libyaml, ruby, gdbm, python 6 | ==> Installing vim dependency: perl 7 | ==> Downloading https://homebrew.bintray.com/bottles/perl-5.24.0_1.el_capitan.bottle.tar.gz 8 | ######################################################################## 100.0% 9 | ==> Pouring perl-5.24.0_1.el_capitan.bottle.tar.gz 10 | ==> Caveats 11 | By default non-brewed cpan modules are installed to the Cellar. If you wish 12 | for your modules to persist across updates we recommend using `local::lib`. 13 | 14 | You can set that up like this: 15 | PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib 16 | echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >> ~/.zshrc 17 | ==> Summary 18 | 🍺 /usr/local/Cellar/perl/5.24.0_1: 2,291 files, 55.1M 19 | ==> Installing vim dependency: libyaml 20 | ==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.1.6_1.el_capitan.bottle.tar.gz 21 | ######################################################################## 100.0% 22 | 23 | 24 | 25 | ==> Pouring libyaml-0.1.6_1.el_capitan.bottle.tar.gz 26 | 🍺 /usr/local/Cellar/libyaml/0.1.6_1: 8 files, 312.8K 27 | ==> Installing vim dependency: ruby 28 | ==> Downloading https://homebrew.bintray.com/bottles/ruby-2.3.1.el_capitan.bottle.tar.gz 29 | ######################################################################## 100.0% 30 | ==> Pouring ruby-2.3.1.el_capitan.bottle.tar.gz 31 | ==> Caveats 32 | Emacs Lisp files have been installed to: 33 | /usr/local/share/emacs/site-lisp/ruby 34 | ==> Summary 35 | 🍺 /usr/local/Cellar/ruby/2.3.1: 1,260 files, 19.0M 36 | ==> Installing vim dependency: gdbm 37 | ==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.12.el_capitan.bottle.tar.gz 38 | ######################################################################## 100.0% 39 | ==> Pouring gdbm-1.12.el_capitan.bottle.tar.gz 40 | 🍺 /usr/local/Cellar/gdbm/1.12: 18 files, 490.7K 41 | ==> Installing vim dependency: python 42 | ==> Downloading https://homebrew.bintray.com/bottles/python-2.7.12.el_capitan.bottle.tar.gz 43 | ######################################################################## 100.0% 44 | ==> Pouring python-2.7.12.el_capitan.bottle.tar.gz 45 | Error: The `brew link` step did not complete successfully 46 | The formula built, but is not symlinked into /usr/local 47 | Could not symlink bin/2to3 48 | Target /usr/local/bin/2to3 49 | already exists. You may want to remove it: 50 | rm '/usr/local/bin/2to3' 51 | 52 | To force the link and overwrite all conflicting files: 53 | brew link --overwrite python 54 | 55 | To list all files that would be deleted: 56 | brew link --overwrite --dry-run python 57 | 58 | 59 | 60 | Possible conflicting files are: 61 | /usr/local/bin/2to3 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/2to3 62 | /usr/local/bin/2to3-2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/2to3-2 63 | /usr/local/bin/2to3-2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/2to3-2.7 64 | /usr/local/bin/idle -> /Library/Frameworks/Python.framework/Versions/2.7/bin/idle 65 | /usr/local/bin/idle2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/idle2 66 | /usr/local/bin/idle2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/idle2.7 67 | /usr/local/bin/pydoc -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc 68 | /usr/local/bin/pydoc2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2 69 | /usr/local/bin/pydoc2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7 70 | /usr/local/bin/python -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python 71 | /usr/local/bin/python-config -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python-config 72 | /usr/local/bin/python2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python2 73 | /usr/local/bin/python2-config -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config 74 | /usr/local/bin/python2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 75 | /usr/local/bin/python2.7-config -> /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config 76 | /usr/local/bin/pythonw -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw 77 | /usr/local/bin/pythonw2 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2 78 | /usr/local/bin/pythonw2.7 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7 79 | /usr/local/bin/smtpd.py -> /Library/Frameworks/Python.framework/Versions/2.7/bin/smtpd.py 80 | /usr/local/bin/smtpd2.7.py -> /Library/Frameworks/Python.framework/Versions/2.7/bin/smtpd2.7.py 81 | /usr/local/bin/smtpd2.py -> /Library/Frameworks/Python.framework/Versions/2.7/bin/smtpd2.py 82 | ==> /usr/local/Cellar/python/2.7.12/bin/python -s setup.py --no-user-cfg install --force --verbose --sing 83 | ==> /usr/local/Cellar/python/2.7.12/bin/python -s setup.py --no-user-cfg install --force --verbose --sing 84 | ==> /usr/local/Cellar/python/2.7.12/bin/python -s setup.py --no-user-cfg install --force --verbose --sing 85 | ==> Caveats 86 | Pip and setuptools have been installed. To update them 87 | pip install --upgrade pip setuptools 88 | 89 | You can install Python packages with 90 | pip install 91 | 92 | They will install into the site-package directory 93 | /usr/local/lib/python2.7/site-packages 94 | 95 | 96 | 97 | See: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Homebrew-and-Python.md 98 | 99 | .app bundles were installed. 100 | Run `brew linkapps python` to symlink these to /Applications. 101 | 102 | ==> Summary 103 | 🍺 /usr/local/Cellar/python/2.7.12: 3,476 files, 46.7M 104 | 105 | 106 | ==> Installing vim 107 | ==> Downloading https://homebrew.bintray.com/bottles/vim-7.4.2085.el_capitan.bottle.tar.gz 108 | ######################################################################## 100.0% 109 | ==> Pouring vim-7.4.2085.el_capitan.bottle.tar.gz 110 | 🍺 /usr/local/Cellar/vim/7.4.2085: 1,692 files, 22.7M 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /MacOSX/Vim/install-vim.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # Mac 系统自带的 vim 是 7.3版本 5 | # brew 安装, 会安装 perl, ruby, python2.7 等, 建议不再安装. 6 | # 7 | 8 | brew install vim -------------------------------------------------------------------------------- /MacOSX/Vim/vim-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # 安装 spf13-vim 配置: 5 | # 6 | # - https://github.com/spf13/spf13-vim 7 | # 8 | 9 | 10 | curl https://j.mp/spf13-vim3 -L > spf13-vim.sh && sh spf13-vim.sh 11 | 12 | 13 | -------------------------------------------------------------------------------- /MacOSX/brew-cask-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | brew cask install atom 5 | 6 | # FTP 下载 7 | brew cask install filezilla 8 | 9 | # 虚拟机 10 | brew cask install virtualbox 11 | 12 | # JDK 13 | brew cask install java 14 | 15 | # 远程主机目录映射到本地 16 | brew cask install sshfs 17 | 18 | # B站 19 | brew cask install bilibili 20 | # 输入法 21 | brew cask install squirrel 22 | # 截图 23 | brew cask install snip 24 | 25 | # 管理 brew 安装的 service 的工具, 26 | # 安装之后可以看所有的 service 的运行状态 27 | brew search launchrocket 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /MacOSX/brew-install-jenkins.md: -------------------------------------------------------------------------------- 1 | 2 | ## homebrew 安装 jenkins 说明: 3 | 4 | 5 | - 需要先要安装JAVA,推荐JAVA1.8 6 | - 工具是java系的 7 | 8 | ### 安装方法: 9 | 10 | 11 | ``` bash 12 | 13 | ➜ ~ brew install jenkins 14 | 15 | ==> Downloading http://mirrors.jenkins-ci.org/war/1.643/jenkins.war 16 | ==> Downloading from http://ftp.tsukuba.wide.ad.jp/software/jenkins/war/1.643/jenkins.war 17 | ==> jar xvf jenkins.war 18 | ==> Caveats 19 | Note: When using launchctl the port will be 8080. 20 | 21 | To have launchd start jenkins at login: 22 | ln -sfv /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents 23 | 24 | Then to load jenkins now: 25 | launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist 26 | 27 | Or, if you don't want/need launchctl, you can just run: 28 | jenkins 29 | 30 | ==> Summary 31 | /usr/local/Cellar/jenkins/1.643: 6 files, 62M, built in 29 seconds 32 | ➜ ~ 33 | 34 | 35 | ``` 36 | 37 | 38 | ### 设置后台启动 jenkins 服务: 39 | 40 | 41 | ``` 42 | 43 | # 重启服务,2步操作: 44 | launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist 45 | launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist 46 | 47 | 48 | # 修改 上述路径下的 jenkins.plist 文件中的端口,改为:8040, 防止和 nginx 冲突 49 | 50 | 访问端口: 51 | 52 | http://127.0.0.1:8040/ 53 | 54 | 55 | 56 | ``` 57 | 58 | ### 安装插件: 59 | 60 | 在左侧的导航找到 Manage Jenkins,进到管理界面,然后找到 Manage Plugins 进入插件管理界面,我们安装几个必须的插件: 61 | 62 | - [GitHub plugin](https://wiki.jenkins-ci.org/display/JENKINS/Github+Plugin) 63 | - [GitHub Pull Request Builder](https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin) 64 | 65 | 66 | 67 | ### 参考文档: 68 | 69 | - [在 Mac mini 上架设 Jenkins 服务器来运行 iOS 测试](http://linjunpop.logdown.com/posts/162202-set-up-jenkins-server-on-the-mac-mini-to-run-ios-tests) 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /MacOSX/brew-install-py2.7.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Mac osx 自带python2.7.10 4 | # 安装python2.7.11 5 | 6 | sudo chown -R `whoami` /usr/local 7 | 8 | brew uninstall -f python 9 | 10 | #sudo rm -rf `brew --cache` 11 | #mkdir `brew --cache` 12 | 13 | brew cleanup 14 | 15 | # 安装: 16 | brew install python 17 | 18 | 19 | # 覆盖 旧的 python-link 20 | brew link --overwrite python 21 | 22 | 23 | -------------------------------------------------------------------------------- /MacOSX/brew-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | brew install git 5 | brew install mercurial 6 | brew install subversion 7 | 8 | brew install tmux 9 | 10 | brew install zsh 11 | 12 | # 切换zsh为默认shell 13 | # chsh -s $(whereis zsh) 14 | chsh -s /bin/zsh 15 | 16 | brew install fish 17 | brew install mobile-shell 18 | 19 | brew install openssl 20 | 21 | 22 | # 下载: 23 | brew install curl 24 | brew install wget 25 | brew install aria2 26 | 27 | 28 | brew install vim 29 | 30 | # 目录快速跳转: 31 | brew install autojump 32 | 33 | # 目录树显示: 34 | brew install tree 35 | 36 | brew install gcc 37 | brew install cmake 38 | brew install ctags 39 | brew install cscope 40 | 41 | 42 | ######################### 43 | # 语言开发 44 | ######################### 45 | brew install go 46 | 47 | brew install node 48 | 49 | # python 开发环境,必装: 50 | brew install pyenv 51 | brew install pyenv-virtualenv 52 | 53 | 54 | # DB: 55 | brew install mongodb 56 | brew install mysql 57 | brew install redis 58 | brew install sqlite 59 | brew install rabbitmq 60 | 61 | 62 | brew install jenkins 63 | 64 | # 注意版本: 65 | brew install nginx 66 | brew install tomcat 67 | 68 | brew install iperf3 69 | 70 | 71 | -------------------------------------------------------------------------------- /MacOSX/fix-user-permission.sh: -------------------------------------------------------------------------------- 1 | 2 | # 如果你看到EACCES: permission denied这样的权限报错, 3 | # 那么请参照上文的homebrew译注,修复/usr/local目录的所有权: 4 | 5 | sudo chown -R `whoami` /usr/local 6 | 7 | 8 | -------------------------------------------------------------------------------- /MacOSX/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## homebrew 常用命令: 3 | 4 | - 帮助 5 | 6 | ```bash 7 | -> % brew 8 | 9 | Example usage: 10 | brew search [TEXT|/REGEX/] 11 | brew (info|home|options) [FORMULA...] 12 | brew install FORMULA... 13 | brew update 14 | brew upgrade [FORMULA...] 15 | brew uninstall FORMULA... 16 | brew list [FORMULA...] 17 | 18 | Troubleshooting: 19 | brew config 20 | brew doctor 21 | brew install -vd FORMULA 22 | 23 | Brewing: 24 | brew create [URL [--no-fetch]] 25 | brew edit [FORMULA...] 26 | https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md 27 | 28 | Further help: 29 | man brew 30 | brew help [COMMAND] 31 | brew home 32 | 33 | 34 | 35 | 36 | # 强制卸载所有版本,否则只卸载最新的版本, 可能残留 旧的版本 37 | brew uninstall --force curl 38 | 39 | 40 | # Makes you owner of /usr/local 41 | 42 | $ sudo chown -R `whoami` /usr/local 43 | 44 | # Force uninstalls failed python 45 | $ brew uninstall -f python 46 | 47 | # Clear the brew cache 48 | $ rm -rf `brew --cache` 49 | 50 | # Recreate the brew cache 51 | $ mkdir `brew --cache` 52 | 53 | # Cleanup - cleans up old homebrew files 54 | $ brew cleanup 55 | 56 | # Prune - removes dead symlinks in homebrew 57 | $ brew prune 58 | 59 | # Doctor - runs homebrew checks for common error causing issues 60 | $ brew doctor 61 | 62 | 63 | ``` 64 | 65 | 66 | ## homebrew 安装路径: 67 | 68 | - 默认所有通过 brew 安装的软件包路径 69 | 70 | ```bash 71 | 72 | /usr/local/Cellar 73 | 74 | 75 | ``` 76 | 77 | 78 | 79 | ## brew cask 命令: 80 | 81 | - 命令: 82 | 83 | 84 | ```bash 85 | 86 | # 查看APP信息: 87 | brew cask info squirrel 88 | 89 | 90 | # 强制卸载: 91 | brew cask uninstall --force XXXX 92 | 93 | 94 | ``` 95 | 96 | 97 | ## 卸载 homebrew 工具本身: 98 | 99 | - 轻易不要卸载, 会导致所有通过 homebrew 安装的软件, 被自动删除.(代价有点高) 100 | - 安装 homebrew, 自动装 brew-cask 工具, 卸载同样. 101 | - [homebrew-FAQ](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/FAQ.md) 102 | 103 | 104 | 105 | ``` 106 | 107 | # uninstall homebrew: 108 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" 109 | 110 | ``` 111 | 112 | 113 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # awesome-script 2 | 3 | ## 迁移: 4 | 5 | - https://github.com/better-sre/config 6 | - ⭐⭐⭐⭐⭐ 7 | - 基于 go-task, 包含各种安装脚本 8 | - 本 repo 已经停止更新, 后续请参考上面 repo 脚本. 9 | 10 | 11 | ## 项目说明: 12 | 13 | ### 初衷: 14 | 15 | - 工作需要经常在各种系统(Ubuntu, CentOS, Mac OSX等)间切换. 16 | - 各系统间, 在安装常用开发包时,有各种细微差异.(如nginx,python,git,Oracle,MySQL,mongodb 等) 17 | - 每次配置新的开发环境,生产环境,都需要搜索安装,很繁琐. 18 | - 现在有 docker 可以减轻负担,但是 build docker 镜像依然需要知道安装方法. 19 | - 很多软件的安装方法,会过时, 版本更新变化很快. 20 | 21 | ### 项目内容: 22 | 23 | - 包含常用软件的shell 安装脚本,以及依赖配置.(包括 Centos, Ubuntu, Mac OSX 等) 24 | - 会有功能说明文档. 25 | - 会注明日期,(安装方法有时效性) 26 | 27 | ### 项目结构: 28 | 29 | - CentOS 30 | - 6.5-X64 31 | - nginx 32 | - python 33 | - mysql 34 | - redis 35 | - mongodb 36 | - Ubuntu 37 | - 14.04-X64 38 | - nginx 39 | - python 40 | - mysql 41 | - redis 42 | - mongodb 43 | - MacOSX 44 | - brew-install.sh 45 | - brew-cask-install.sh 46 | 47 | -------------------------------------------------------------------------------- /docker/Dockerfile/ranzi-oa/Dockerfile: -------------------------------------------------------------------------------- 1 | # 官方源: 2 | #FROM ubuntu:14.04 3 | 4 | # 国内镜像源 5 | #FROM dl.dockerpool.com:5000/ubuntu:14.04 6 | 7 | # 阿里云镜像源: 8 | FROM registry.cn-hangzhou.aliyuncs.com/docker/ubuntu14.04 9 | 10 | # 添加作者签名 11 | MAINTAINER hhstore 12 | 13 | 14 | # 版本号更新 15 | ENV REFRESHED_AT 2016-08-15 16 | 17 | 18 | # 安装依赖 19 | RUN apt-get update -y && \ 20 | apt-get install -y wget 21 | 22 | 23 | # 下载一键安装包: 24 | RUN wget http://dl.cnezsoft.com/ranzhi/3.5/RanZhi.3.5.zbox_64.tar.gz 25 | 26 | 27 | # 解压到: /opt/ 目录 28 | RUN tar zxvf RanZhi*.tar.gz -C /opt/ 29 | 30 | 31 | # 启动服务: 32 | CMD ["/opt/zbox/zbox start "] 33 | 34 | 35 | # 端口暴露: 36 | EXPOSE 80 # web 服务 端口 37 | #EXPOSE 3306 # MySQL 端口 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /docker/Dockerfile/ranzi-oa/docker-compose.yml: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # docker compose 配置文件说明: 4 | # 5 | # docker-compose.yml 需要和 Dockerfile 文件,在同一目录下. 6 | # 7 | # 官方参考文档: 8 | # - https://docs.docker.com/compose/gettingstarted/ 9 | # - https://docs.docker.com/compose/compose-file/ 10 | # - https://docs.docker.com/compose/rails/ 11 | # 12 | # 常用命令: (查看帮助: docker-compose --help) 13 | # - 启动: 14 | # - docker-compose up # boot the app 15 | # - docker-compose up -d # 后台运行 16 | # - 查看启动进程: 17 | # - docker-compose ps 18 | # - 其他: 19 | # - docker-compose build # build the image 20 | # - docker-compose run web env 21 | # - docker-compose stop 22 | # 23 | # yaml配置文件说明: 24 | # - 是一种比json更优雅,简洁的配置文件格式 25 | # - 语法很简单 26 | # 27 | # 28 | ################################################################## 29 | 30 | oa_server: 31 | build: ./ # 根据当前目录下的 Dockerfile, 构建 image, 并命名为 image 名 32 | image: ranzhi:20160815 # 构建, 并命名镜像名: ranzhi:20160815 33 | container_name: ranzhi-v1.0 # 指定 容器名 34 | ports: 35 | - "80": "8001" # 端口映射: [容器内: 宿主机] 36 | expose: 37 | - "80" # 端口暴露: 容器之间 link 用 38 | restart: always # 自动重启 39 | command: /opt/zbox/zbox start # 启动服务 40 | 41 | 42 | # 执行/opt/zbox/zbox start 命令开启Apache和Mysql。 43 | # 执行/opt/zbox/zbox stop 命令停止Apache和Mysql。 44 | # 执行/opt/zbox/zbox restart 命令重启Apache和Mysql。 45 | # 使用/opt/zbox/zbox -h命令 来获取关于zbox命令的帮助 46 | 47 | 48 | 49 | 50 | #mongo: 51 | # image: mongo:3.1 52 | # volumes: 53 | # - /data/db31:/data/db 54 | # expose: 55 | # - "27017" 56 | # command: mongod --storageEngine wiredTiger --dbpath /data/db 57 | 58 | 59 | 60 | #$ ls 61 | #Dockerfile app docker-compose.yml tmp 62 | #Gemfile bin lib vendor 63 | #Gemfile.lock config log 64 | #README.rdoc config.ru public 65 | #Rakefile db test 66 | -------------------------------------------------------------------------------- /docker/Dockerfile/ranzi-oa/readme.md: -------------------------------------------------------------------------------- 1 | # 然之 OA 系统的 docker 镜像说明: 2 | 3 | - 然之 OA 是一套开源免费的 OA 系统, 试用感觉还可以. 4 | - 根据官方提供的一键安装包,进行部署, 发现 和 禅道, 部署路径相互重叠. 5 | - 为了偷懒, 制作成 docker 镜像, 这样快速解决冲突问题. 6 | - docker 容器启动时,简单做端口映射, 就可以用啦. 7 | - 虽然不推荐把数据库放在 docker image 里, 不过, 为了偷懒, 暂时不管. 8 | - docker-compose.yml 里可配置参数: volume 挂载宿主机目录, 映射 MySQL 数据库路径 9 | 10 | 11 | ## 使用说明: 12 | 13 | - 使用 docker-compose.yml 运行 14 | 15 | 16 | ### 1. 使用阿里云构建: 17 | 18 | - [阿里云 - Docker 镜像服务](https://hpc.aliyun.com/doc/docker%E9%95%9C%E5%83%8F%E6%9C%8D%E5%8A%A1) 19 | - [阿里云 - Docker Hub](http://dev.aliyun.com/search.html) 20 | - [阿里云Docker镜像库](http://get.ftqq.com/6267.get) 21 | 22 | 23 | 24 | ## 参考: 25 | 26 | - [linux用一键安装包 - 说明文档](https://www.ranzhico.com/book/install/61.html) 27 | - [Docker 极速下载](https://get.daocloud.io/) 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docker/Dockerfile/readme.md: -------------------------------------------------------------------------------- 1 | 2 | # 参考: 3 | 4 | 5 | 6 | ## 阿里云 docker 镜像源: 7 | - [阿里云 - Docker 镜像服务](https://hpc.aliyun.com/doc/docker%E9%95%9C%E5%83%8F%E6%9C%8D%E5%8A%A1) 8 | - [阿里云 - 容器服务 官方文档](https://help.aliyun.com/product/25972.html?spm=5176.doc42988.3.1.r86VMQ) 9 | - [阿里云 - 如何提高docker镜像构建成功率](https://help.aliyun.com/document_detail/25985.html) 10 | - [阿里云Docker镜像库](http://get.ftqq.com/6267.get) 11 | 12 | 13 | ```docker 14 | From registry.mirrors.aliyuncs.com/library/ubuntu:14.0 15 | 16 | 17 | 18 | ``` -------------------------------------------------------------------------------- /docker/Dockerfile/xiaowei-oa/Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | # 3 | FROM tomsik68/xampp 4 | 5 | 6 | # 添加作者签名 7 | MAINTAINER hhstore 8 | 9 | 10 | # 版本号更新 11 | ENV REFRESHED_AT 2016-08-16 12 | 13 | 14 | RUN apt-get update -y && \ 15 | apt-get install -y git 16 | 17 | 18 | # 19 | RUN mkdir /www 20 | RUN ln -s /www /opt/lampp/htdocs/ 21 | 22 | 23 | # 下载源码: 24 | RUN git clone git@git.oschina.net:smeoa/smeoa.git /www/oa 25 | 26 | 27 | RUN chmod 777 /www/oa/index.php 28 | RUN chmod 777 /www/oa/install.php 29 | RUN chmod 777 /www/oa/App/Conf/db.php 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docker/Dockerfile/xiaowei-oa/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## 小微 OA 构建: 3 | 4 | 5 | ## 配置 xampp: 6 | 7 | ``` 8 | # 更改 ap 端口: 80 改为 8080 (端口冲突) 9 | 10 | # 所有配置都在 etc 目录下: 11 | 12 | /opt/lampp/etc/httpd.conf 13 | 14 | 15 | ``` 16 | 17 | ## 小微 OA 安装引导页面: 18 | 19 | - [安装引导页面](http://www.jollytech.com.cn/oa/install.php) 20 | - 项目安装目录: /opt/lampp/htdocs/oa 21 | 22 | 23 | -------------------------------------------------------------------------------- /docker/Dockerfile/zentao-pms/Dockerfile: -------------------------------------------------------------------------------- 1 | #FROM ubuntu:14.04 2 | # 国内镜像源 3 | FROM dl.dockerpool.com:5000/ubuntu:14.04 4 | 5 | 6 | # 添加作者签名 7 | MAINTAINER hhstore 8 | 9 | 10 | # 版本号更新 11 | ENV REFRESHED_AT 2016-08-15 12 | 13 | 14 | # 安装依赖 15 | RUN apt-get update -y && \ 16 | apt-get install -y --no-install-recommends \ 17 | wget 18 | 19 | 20 | # 下载一键安装包: 21 | RUN wget http://dl.cnezsoft.com/zentao/8.2.5/ZenTaoPMS.8.2.5.zbox_64.tar.gz 22 | 23 | 24 | # 解压到: /opt/ 目录 25 | RUN tar zxvf ZenTaoPMS*.tar.gz -C /opt/ 26 | 27 | 28 | # 启动服务: 29 | CMD ["/opt/zbox/zbox start "] 30 | 31 | 32 | # 端口暴露: 33 | EXPOSE 80 # web 服务 端口 34 | #EXPOSE 3306 # MySQL 端口 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docker/Dockerfile/zentao-pms/docker-compose.yml: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # docker compose 配置文件说明: 4 | # 5 | # docker-compose.yml 需要和 Dockerfile 文件,在同一目录下. 6 | # 7 | # 官方参考文档: 8 | # - https://docs.docker.com/compose/gettingstarted/ 9 | # - https://docs.docker.com/compose/compose-file/ 10 | # - https://docs.docker.com/compose/rails/ 11 | # 12 | # 常用命令: (查看帮助: docker-compose --help) 13 | # - 启动: 14 | # - docker-compose up # boot the app 15 | # - docker-compose up -d # 后台运行 16 | # - 查看启动进程: 17 | # - docker-compose ps 18 | # - 其他: 19 | # - docker-compose build # build the image 20 | # - docker-compose run web env 21 | # - docker-compose stop 22 | # 23 | # yaml配置文件说明: 24 | # - 是一种比json更优雅,简洁的配置文件格式 25 | # - 语法很简单 26 | # 27 | # 28 | ################################################################## 29 | 30 | pms_server: 31 | build: ./ # 根据当前目录下的 Dockerfile, 构建 image, 并命名为 image 名 32 | image: zentao:20160815 # 构建, 并命名镜像名: zentao:20160815 33 | container_name: zentao-v1.0 # 指定 容器名 34 | ports: 35 | - "80": "8002" # 端口映射: [容器内: 宿主机] 36 | expose: 37 | - "80" # 端口暴露: 容器之间 link 用 38 | restart: always # 自动重启 39 | command: /opt/zbox/zbox start # 启动服务 40 | 41 | 42 | # 执行/opt/zbox/zbox start 命令开启Apache和Mysql。 43 | # 执行/opt/zbox/zbox stop 命令停止Apache和Mysql。 44 | # 执行/opt/zbox/zbox restart 命令重启Apache和Mysql。 45 | # 使用/opt/zbox/zbox -h命令 来获取关于zbox命令的帮助 46 | 47 | 48 | 49 | 50 | #mongo: 51 | # image: mongo:3.1 52 | # volumes: 53 | # - /data/db31:/data/db 54 | # expose: 55 | # - "27017" 56 | # command: mongod --storageEngine wiredTiger --dbpath /data/db 57 | 58 | 59 | 60 | #$ ls 61 | #Dockerfile app docker-compose.yml tmp 62 | #Gemfile bin lib vendor 63 | #Gemfile.lock config log 64 | #README.rdoc config.ru public 65 | #Rakefile db test 66 | -------------------------------------------------------------------------------- /docker/Dockerfile/zentao-pms/readme.md: -------------------------------------------------------------------------------- 1 | # 禅道 - 项目管理系统 docker 镜像说明: 2 | 3 | - 禅道是一套开源免费的 项目管理系统, 国内互联网公司大量使用. 4 | - 根据官方的一键安装包构建的 docker image. 5 | 6 | 7 | ## 使用说明: 8 | 9 | - 使用 docker-compose.yml 运行 10 | 11 | 12 | ## 源码安装步骤: 13 | 14 | - [安装初始化 - 引导页面](http://127.0.0.1/pms/www/install.php) 15 | 16 | 17 | ## 参考: 18 | 19 | 20 | - [禅道 - linux用一键安装包 - 说明文档](http://www.zentao.net/book/zentaopmshelp/90.html) 21 | 22 | - [使用源码包安装](http://www.zentao.net/book/zentaopmshelp/101.html) 23 | 24 | 25 | 26 | 27 | ## 进销存管理系统: 28 | 29 | - [亿斗](http://www.yidou.com.cn/) 30 | 31 | 32 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | # awesome-docker 2 | 一些开发的 dockerfile 文件. 3 | 4 | 5 | ## Dockerfile 项目列表: 6 | 7 | - [禅道 - 项目管理系统](Dockerfile/zentao-pms/) 8 | - [然之 - OA](Dockerfile/ranzi-oa/) 9 | 10 | 11 | 12 | ## 参考: 13 | 14 | - [docker-compose 语法规则](https://docs.docker.com/compose/compose-file/) 15 | - [awesome-docker](https://github.com/veggiemonk/awesome-docker) 16 | - [大量 dockerfile 参考](https://github.com/jfrazelle/dockerfiles) 17 | - [dockerfile 参考2](https://github.com/crosbymichael/Dockerfiles) 18 | - [dockerfile 参考3](https://github.com/komljen/dockerfile-examples) 19 | - [dockerfile 参考4](http://dockerfile.github.io/) 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /pip/pip-aliyun-mirrors/config-pip-mirrors.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ################################################# 4 | # 5 | # 1. 用户根目录,创建 .pip 目录 6 | # 2. 将 pip 阿里云镜像源配置文件, 拷贝到 .pip 目录. 7 | # 3. 安装测试: 8 | # - pip3 install flask 9 | # - 提示信息: 从 阿里云 的镜像站点下载. 10 | ################################################# 11 | 12 | 13 | cd ~ 14 | 15 | mkdir .pip 16 | 17 | # 添加镜像源 18 | cp ./pip.conf ~/.pip 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /pip/pip-aliyun-mirrors/pip.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | index-url=http://mirrors.aliyun.com/pypi/simple/ 3 | 4 | [install] 5 | trusted-host=mirrors.aliyun.com -------------------------------------------------------------------------------- /pip/pip-install-flask-dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | pip install -r ./requirements/flask-requirements.txt 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /pip/pip-install-tornado-dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | pip install -r ./requirements/tornado-requirements.txt 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /pip/readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 常用 Python 开发包: 4 | 5 | ## 常用基础功能包: 6 | 7 | - requests 等 8 | 9 | 10 | ## 常用 web 框架相关: 11 | 12 | - flask 13 | - tornado 14 | - django 15 | 16 | 17 | -------------------------------------------------------------------------------- /pip/requirements/base.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | # HTTP: 4 | requests 5 | 6 | simplejson==3.6.5 7 | 8 | # MQ: 9 | celery 10 | pika 11 | 12 | 13 | # DB, ORM: 14 | pymongo 15 | mongoengine 16 | redis 17 | 18 | MySQL-python==1.2.5 19 | SQLAlchemy==0.9.8 20 | 21 | 22 | # Docker: 23 | docker-py==1.1.0 24 | 25 | 26 | # IMAGE: 27 | # python x64bit 28 | Pillow 29 | 30 | # python x32bit 31 | #pil 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /pip/requirements/django-requirements.txt: -------------------------------------------------------------------------------- 1 | Django 2 | 3 | django-celery 4 | django-debug-toolbar 5 | django-extensions 6 | django-hosts 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /pip/requirements/flask-requirements.txt: -------------------------------------------------------------------------------- 1 | flask 2 | 3 | 4 | 5 | flask-mongoengine 6 | 7 | Flask==0.10.1 8 | Flask-Admin==1.0.8 9 | Flask-Cache==0.13.1 10 | Flask-ErrorMail==0.2.2 11 | Flask-Gravatar==0.4.1 12 | Flask-Login==0.2.11 13 | Flask-Mail==0.9.1 14 | Flask-OAuthlib==0.7.0 15 | Flask-SQLAlchemy==2.0 16 | Flask-Testing==0.4.2 17 | Flask-WTF==0.10.3 18 | 19 | -------------------------------------------------------------------------------- /pip/requirements/tools.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 部署 4 | fabric 5 | 6 | 7 | # 环境隔离: 8 | zc.buildout 9 | -------------------------------------------------------------------------------- /pip/requirements/tornado-requirements.txt: -------------------------------------------------------------------------------- 1 | tornado 2 | 3 | --------------------------------------------------------------------------------