Categories
- FFMpeg (5)
- Libav (1)
- Google (3)
- iBeacon (1)
- LDAP (3)
- Me (2)
- Network (11)
- OS (149)
- RTMP (4)
- SIP (1)
- Kamailio (1)
- SNMP (1)
- VMware (20)
- VCP考試 (1)
- 伺服器 網站服務 (105)
- 名詞解釋 (4)
- 專案管理 (1)
- 工具軟體 (50)
- Adobe (1)
- FMS (1)
- Cloudera (1)
- Docker (1)
- Eclipse (4)
- Intellij (2)
- OBS (2)
- Office (10)
- Excel (4)
- PowerPoint (5)
- Postman (1)
- Splunk (13)
- Virtualbox (2)
- Visual Studio (2)
- 文字編輯器 (10)
- Sublime Text 2 (6)
- Sublime Text 3 (3)
- Vim (3)
- 連線工具 (1)
- Xshell (1)
- Adobe (1)
- 程式語言 (79)
- CSS (2)
- HTML (2)
- iOS (1)
- Java (30)
- JavaScript (5)
- jQuery (4)
- jsTree (2)
- JSP (3)
- PHP (16)
- Python (7)
- Ruby (1)
- sed (1)
- Shell Script (8)
- Windows Bash Script (1)
- XML (1)
- 資料庫 (37)
- FFMpeg (5)
Category Archives: Ubuntu
Ubuntu 關閉 ipv6
修改設定檔
1 2 3 4 5 |
sudo vim /etc/sysctl.conf # 最後面加入下面 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 |
直接套用
1 |
sudo sysctl -p |
Posted in Ubuntu
Leave a comment
Wisemapping in Ubuntu 14.04 x64 server
Wisemapping 環境 : Ubuntu 14.04 x64 server 檢查系統是否已裝了 java development kit,如果是openjdk就先移除掉
1 |
java -version |
安裝 Java Development Kit (版本>7)
1 2 3 4 |
sudo apt-get install software-properties-common python-software-properties sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer |
下載 wisemapping binary檔案
1 |
wget https://bitbucket.org/wisemapping/wisemapping-open-source/downloads/wisemapping-v3.0.4.zip |
安裝 unzip
1 |
sudo apt-get install unzip |
解壓縮 wisemapping 檔案
1 |
unzip wisemapping-v3.0.4.zip |
切換到 wisemapping 目錄中
1 |
cd wisemapping-v3.0.4 |
測試執行
1 2 3 |
java -Dorg.apache.jasper.compiler.disablejsr199=true -jar start.jar # 看到 INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080 代表正常啟動 # 可用瀏覽器觀看 http://ip:8080/wisemapping |
安裝 mysql server、nginx
1 |
sudo apt-get install mysql-server nginx |
編輯 … Continue reading
Posted in MySQL, Ubuntu, Wisemapping
Leave a comment
Etherpad-lite in Ubuntu 14.04 x64 server
etherpad 安裝基本套件需求
1 |
sudo apt-get install gzip git-core curl python libssl-dev pkg-config build-essential |
更新安裝nodejs的來源
1 |
sudo curl -sL https://deb.nodesource.com/setup | sudo bash - |
安裝nodejs
1 |
sudo apt-get install nodejs |
新增etherpad的使用者
1 2 |
sudo useradd etherpad -m -s /bin/bash -r sudo passwd etherpad |
將etherpad使用者加入sudoers中
1 |
sudo usermod -a -G sudo etherpad |
切換到etherpad使用者
1 |
su - etherpad |
下載etherpad檔案
1 |
wget https://github.com/ether/etherpad-lite/zipball/master |
安裝unzip
1 |
sudo apt-get install unzip |
解壓縮etherpad壓縮檔
1 |
unzip master |
將目錄名稱變好看一點
1 |
mv ether-etherpad-lite-3ebcaad etherpad-lite |
切換到etherpad-lite目錄
1 |
cd etherpad-lite |
複製設定檔範本
1 |
cp settings.json.template setting.json |
設定etherpad基本環境
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
vim setting.json # 找到以下的設定加以替換 "requireSession" : false, "sessionNoPassword" : false, "requireAuthentication": false, "requireAuthorization": true, "users": { "admin": { "password": "password", "is_admin": true }, "user": { "password": "password", "is_admin": false } }, |
試執行,可看 http://ip:9001 是否正常
1 |
./bin/run.sh |
安裝mysql、nginx
1 |
sudo apt-get install mysql-server nginx |
建立etherpad資料庫、設定使用者權限
1 2 3 4 |
mysql -uroot -p > create database etherpad; > grant all privileges on etherpad.* to 'etherpad'@'localhost' identified by 'password'; > exit |
設定etherpad資料存放使用mysql
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
vim setting.json # 註解使用dirty的部分 //"dbType" : "dirty", //"dbSettings" : { // "filename" : "var/dirty.db" // }, # 加入使用mysql的部分 "dbType" : "mysql", "dbSettings" : { "user" : "etherpad", "host" : "localhost", "password": "password", "database": "etherpad" }, |
試執行,並請連至 http://ip:9001 增加幾筆資料 … Continue reading
Posted in etherpad, MySQL, Nagios, Ubuntu
Leave a comment
Git Server 安裝 (New)
OS: Ubuntu 14.04 Server x64 安裝Gitlab + MySQL + Nginx 系統更新
1 2 3 |
apt-get update apt-get upgrade -y apt-get dist-upgrade |
安裝基本需求
1 2 3 |
# 記得要先裝vim update-alternatives --set editor /usr/bin/vim.basic sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate cmake |
安裝python
1 2 3 4 5 6 7 8 9 10 11 12 |
sudo apt-get install -y python python --version python2 --version # 確認 python版本,如果版本是3.x以上,則需額外安裝2.x版 # sudo apt-get install -y python2.7 # python --version # Python 2.7.3 # python2 --version # 命令執行會採用 python2, 所以需要確認 python2 的版本 # python2 不存在的話, 需要把 python 2.7 版 的 ln 過去. # sudo ln -s /usr/bin/python /usr/bin/python2 apt-get install -y python-docutils |
安裝Git
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# 檢查Git目前可apt安裝的版本 apt-cache showpkg git-core # 如果版本大於1.7.10,則可以直接使用~否則建議手動安裝新版本 # 直接安裝 => apt-get install -y git-core # 如果原本就安裝舊有版本,移除 => apt-get remove git-core # 手動安裝Git apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential cd /tmp curl --progress https://git-core.googlecode.com/files/git-1.9.0.tar.gz | tar xz cd git-1.9.0/ make prefix=/usr/local all make prefix=/usr/local install |
安裝Ruby
1 2 3 4 5 6 7 8 9 10 11 12 |
# 如果裝有1.8版,先行移除 # apt-get remove ruby1.8 mkdir /tmp/ruby && cd /tmp/ruby curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz | tar xz cd ruby-2.0.0-p481/ ./configure --disable-install-rdoc # 下面這行可以用 make 就好 make -j `cat /proc/cpuinfo | grep 'cpu cores' | awk '{if ($4=1) print $4; else print $4-1}'` make install gem install bundler --no-ri --no-rdoc |
新增Gitlab系統帳號
1 |
adduser --disabled-login --gecos 'GitLab' git |
安裝GitLab Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
cd /home/git sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git cd gitlab-shell # 查看最新版本為何 # 或是使用 sudo -u git -H git checkout `sudo -u git -H git describe --abbrev=0 --tags` 自動判斷安裝最新版 sudo -u git -H git tag sudo -u git -H git checkout v2.1.0 sudo -u git -H cp config.yml.example config.yml #修改gitlab_url,改成要使用的domain sudo -u git -H editor config.yml sudo -u git -H ./bin/install |
安裝MySQL Database
1 2 3 4 5 6 7 8 9 |
apt-get install -y mysql-server mysql-client libmysqlclient-dev mysql -u root -p #修改密碼 > CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'GITLAB_PASSWORD'; > CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; >GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; # 使用gitlab帳號測試MySQL sudo -u git -H mysql -u gitlab -p -D gitlabhq_production |
安裝GitLab
1 2 3 4 5 6 7 8 9 10 |
cd /home/git sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab cd /home/git/gitlab # 檢查版本,找stable的 # 或是使用下面自動判斷最新且stable的版本進行安裝 # sudo -u git -H git checkout `sudo -u git -H git branch -a | grep 'stable' | awk 'E ND{print}' | awk 'split($1, version, "/") {print version[3]}'` sudo -u git -H git branch -a sudo -u git -H git checkout 7-0-stable |
設定GitLab
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
cd /home/git/gitlab sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml # 所有 localhost 改成要使用的domain. # /usr/bin/git 改成 /usr/local/bin/git sudo -u git -H editor config/gitlab.yml #調整檔案權限 chown -R git log/ chown -R git tmp/ chmod -R u+rwX log/ chmod -R u+rwX tmp/ sudo -u git -H mkdir /home/git/gitlab-satellites sudo -u git -H mkdir tmp/pids/ sudo -u git -H mkdir tmp/sockets/ chmod -R u+rwX tmp/pids/ chmod -R u+rwX tmp/sockets/ sudo -u git -H mkdir public/uploads chmod -R u+rwX public/uploads sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb chmod -R u+rwX public/uploads sudo -u git -H mkdir public/uploads #如果硬體記憶體規格超過2G,可將worker_processes改成3 #sudo -u git -H editor config/unicorn.rb sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.email "gitlab@localhost" sudo -u git -H git config --global core.autocrlf input |
GitLab DB設計
1 2 3 4 5 6 |
sudo -u git cp config/database.yml.mysql config/database.yml # 將production區塊的secure password值改成MySQL gitlab帳號設定的帳號、密碼 sudo -u git -H editor config/database.yml sudo -u git -H chmod o-rwx config/database.yml |
安裝Gems
1 2 |
cd /home/git/gitlab sudo -u git -H bundle install --deployment --without development test postgres aws |
初始化 Database
1 2 3 4 5 6 |
# 問啥就輸入yes以便建立Database sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production # 取得系統預設帳號、密碼 (所有新安裝都一樣,務必要更改) Administrator account created: login.........admin@local.host password......5iveL!fe |
Posted in Git, Nginx, Ubuntu
Leave a comment
更換 apt-get 來源
1 2 3 |
root@ubuntu:~# vim /etc/apt/sources.list :%s/us.archive.ubuntu.com/tw.archive.ubuntu.com/g |
或是
1 |
root@ubuntu:~# sed -i 's/us.archive.ubuntu.com/tw.archive.ubuntu.com/g' /etc/sources.list |
記得要在apt-get update一下.. 基本上國網 free.nchc.org 應該也可以 但是不知道為什麼一直出錯 如果想要用國網的點,就把tw.archive.ubuntu.com改成free.nchc.org
Posted in Ubuntu
Leave a comment
Nginx SSL Enable
環境: Ubuntu 14.04 x64 產生key
1 2 3 4 5 6 7 |
root@Wordpress:/tmp# openssl genrsa -des3 -out site.key 2048 Generating RSA private key, 2048 bit long modulus ..........................+++ ....................................+++ e is 65537 (0x10001) Enter pass phrase for site.key: Verifying - Enter pass phrase for site.key: |
2.產生 csr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
root@Wordpress:/tmp# openssl req -new -key site.key -out site.csr Enter pass phrase for site.key: You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:TW State or Province Name (full name) [Some-State]:Taiwan Locality Name (eg, city) []:Taipei City Organization Name (eg, company) [Internet Widgits Pty Ltd]:Cowman Organizational Unit Name (eg, section) []:IT Common Name (e.g. server FQDN or YOUR name) []:cowman.ip Email Address []:cowman.chiang@gmail.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: |
cat csr,貼至申請處
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
root@Wordpress:/tmp# cat site.csr -----BEGIN CERTIFICATE REQUEST----- MIIC1DCCAbwCAQAwgY4xCzAJBgNVBAYTAlRXMQ8wDQYDVQQIDAZUYWl3YW4xFDAS BgNVBAcMC1RhaXBlaSBDaXR5MQ8wDQYDVQQKDAZDb3dtYW4xCzAJBgNVBAsMAklU MRIwEAYDVQQDDAljb3dtYW4uaXAxJjAkBgkqhkiG9w0BCQEWF2Nvd21hbi5jaGlh bmdAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2oNl FGzEzzpVSvFkwrYegC1VxoznmsPp2UrImb+w2M4ZLLuqdAqjhLs1atnPaQZsQlOF wfbnbGvcdwULuIzU8o1o1v7KS7TmWfi7P3oYG5GBRq/j3QuOQEwQ1s0QFAnulso9 rAHCt4i1rFg8wNF6mEF1Ghd2DzzD8P7Ew+LCYq+C4G8yq44RD+WJ8DccA4OQfzou mcstrRkXWmoYyrICepCE4eqxSdlNH3dyZbSmG4yKC1gQc60/Utm5o8lGynvS0pBh PUx124eMsWz80wZ0xAkE6Ma24XgOHied3XuaiRfBi5/tql+wfEQBrIOZ0DJ1DAhN J723zUMw9amQ8cF4zQIDAQABoAAwDQYJKoZIhvcNAQELBQADggEBAGeLtDAWlgh6 ag+PP8YqXrxGSAkkyL8EKdrPEntgYEPIkKt9to+h0tKBCZ5kCvG4bL6V5zRhtx4f ViqTzh9itOI3MDfvE5o8vxhed4jzevIifpKDONt0bAOC73STpv9+HCR+CMNX0Erf tmhD+zuLwHcBl5qoZqaPQobPF1VR1U2jsGBZ2HTTamtjGcr0mkso3MO5QxcV8JkP DwAc/PGn06zzKUyPeGPY2PE2xAppcof8B/WOYLvRx202YeoG6Cp1hLT94GoN+ef/ aDwd7WgaFpC1sXTnjoOlzpsxoovHmaJMTskncYkUZIsg4ZvhJnF9trqu9XlUKBh7 vDAfX3ZNzCs= -----END CERTIFICATE REQUEST----- |
這裡一樣以namecheap的comodo ssl為例,會收到下面四個檔案 伺服器類型選nginx AddTrustExternalCARoot.crt COMODORSAAddTrustCA.crt COMODORSADomainValidationSecureServerCA.crt cowman_ip.crt 產生 ssl-bundle.crt
1 |
cat cowman_ip.crt COMODORSAAddTrustCA.crt COMODORSADomainValidationSecureServerCA.crt AddTrustExternalCARoot.crt >> ssl-bundle.crt |
移除需要輸入 phase 的機制
1 2 3 |
root@Wordpress:/tmp# openssl rsa -in site.key -out site-nopass.key Enter pass phrase for site.key: writing RSA key |
修改 nginx 設定檔,位置在 /etc/nginx/sites-enabled/default,這裡把設定檔整併在server中
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
root@Wordpress:/tmp# vim /etc/nginx/sites-enabled/default server { #listen 80 default_server; #listen [::]:80 default_server ipv6only=on; listen 80; listen 443 default ssl; ssl_certificate /opt/local/nginx/conf/certs/ssl-bundle.crt; ssl_certificate_key /opt/local/nginx/conf/certs/site_ip.key; ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; ssl_prefer_server_ciphers on; |
重新啟動 nginx
1 |
service nginx restart |
Posted in Nginx, SSL, Ubuntu
Leave a comment
Gitlab改使用GMail SMTP
檢查 config/environments/production.rb 檔案,查看 config.action_mailer.delivery_method = :sendmail 的註解是否已增加,關閉Gitlab sendmail寄送服務 config.action_mailer.delivery_method = :sendmail [註] 使用這一篇 使用GMail SMTP寄信 (Ubuntu) 的方法應該也可以~但是目前會出現 “Mail failure – no recipient addresses” A message that you sent using the -t command line option contained no addresses that were not … Continue reading
Posted in Git, Ubuntu
Leave a comment
使用GMail SMTP寄信 (Ubuntu)
安裝mailx、exim4 apt-get install exim4-daemon-light mailutils dpkg-reconfigure exim4-config General type of mail configuration: │ internet site; mail is sent and received directly using SMTP │ │ mail sent by smarthost; received via SMTP or fetchmail │ │ mail sent by smarthost; … Continue reading
Posted in Ubuntu
Leave a comment
Ubuntu x64 快速安裝 Nginx with RTMP module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#!/bin/sh apt-get install build-essential libpcre3 libpcre3-dev libssl-dev libxslt-dev -y cd /tmp wget http://nginx.org/download/nginx-1.7.3.tar.gz wget https://github.com/arut/nginx-rtmp-module/archive/master.zip tar -zxvf nginx-1.7.3.tar.gz apt-get install unzip -y unzip master.zip cd nginx-1.7.3/ ./configure --with-http_ssl_module --with-http_xslt_module --add-module=../nginx-rtmp-module-master make make install cp /tmp/nginx-rtmp-module-master/stat.xsl /usr/local/nginx/html/ cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak echo " " >> /usr/local/nginx/conf/nginx.conf echo "rtmp {" >> /usr/local/nginx/conf/nginx.conf echo " server {" >> /usr/local/nginx/conf/nginx.conf echo " listen 1935;" >> /usr/local/nginx/conf/nginx.conf echo " chunk_size 4096;" >> /usr/local/nginx/conf/nginx.conf echo " " >> /usr/local/nginx/conf/nginx.conf echo " application live {" >> /usr/local/nginx/conf/nginx.conf echo " live on;" >> /usr/local/nginx/conf/nginx.conf echo " record off;" >> /usr/local/nginx/conf/nginx.conf echo " #allow publish 127.0.0.1;" >> /usr/local/nginx/conf/nginx.conf echo " #deny publish all;" >> /usr/local/nginx/conf/nginx.conf echo " #allow play 127.0.0.1;" >> /usr/local/nginx/conf/nginx.conf echo " #deny play all;" >> /usr/local/nginx/conf/nginx.conf echo " }" >> /usr/local/nginx/conf/nginx.conf echo " }" >> /usr/local/nginx/conf/nginx.conf echo "}" >> /usr/local/nginx/conf/nginx.conf # 這邊請複製 http://wiki.nginx.org/Nginx-init-ubuntu 內容至 nginx 檔案中 cd /etc/init.d/ vim nginx chmod +x nginx service nginx start # service nginx start|stop|reload |
Posted in Nginx, Ubuntu
Leave a comment
Nginx init script (Ubuntu)
將下列內容貼到 /etc/init.d/nginx 中,並且使用 chmod +x nginx 調整屬性
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
#! /bin/sh ### BEGIN INIT INFO # Provides: nginx # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the nginx web server # Description: starts nginx using start-stop-daemon ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/sbin/nginx NAME=nginx DESC=nginx test -x $DAEMON || exit 0 # Include nginx defaults if available if [ -f /etc/default/nginx ] ; then . /etc/default/nginx fi set -e case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON echo "$NAME." ;; restart|force-reload) echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON sleep 1 start-stop-daemon --start --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; reload) echo -n "Reloading $DESC configuration: " start-stop-daemon --stop --signal HUP --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON echo "$NAME." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0 |