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: CentOS
[Python] fix error while loading shared libraries: libpython2.7.so.1.0
error log: /opt/rh/python27/root/usr/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory check libpython2.7.so.1.0 exist? find . -name ‘libpython2.7.so.1.0’ if the file was exist: edit the ldconfig config echo “/opt/rh/python27/root/usr/lib64” > /etc/ld.so.conf.d/python27.conf ldconfig … Continue reading
Posted in CentOS, Python
Leave a comment
Add git branch name to bash prompt
edit ~/.bash_profile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
if [ -f $(xcode-select -p)/usr/share/git-core/git-completion.bash ]; then . $(xcode-select -p)/usr/share/git-core/git-completion.bash . $(xcode-select -p)/usr/share/git-core/git-prompt.sh fi #enables color in the terminal bash shell export CLICOLOR=1 #sets up the color scheme for list export LSCOLORS=ExFxCxDxBxegedabagacad #sets up the prompt color (currently a green similar to linux terminal) export PS1='\n\[\e[1;30m\]┌─\[\e[0m\]\[\e[01;343m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\n\[\e[1;30m\]└──\[\e[0m\]\$ \[\e[00;33m\]$(__git_ps1 "(%s)")\[\e[00m\]' #enables color for iTerm export TERM=xterm-color |
Apache SSL Enable
環境 CentOS 5.x i386 產生 key
1 2 3 4 5 6 7 |
[root@Web test]# 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: |
產生 csr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@Web test]# openssl req -new -key site.key -out site.csr Enter pass phrase for site.key: #輸入剛剛產生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) [GB]:TW State or Province Name (full name) [Berkshire]:Taiwan Locality Name (eg, city) [Newbury]:Taipei City Organization Name (eg, company) [My Company Ltd]:Cowman Organizational Unit Name (eg, section) []:IT Common Name (eg, your name or your server's hostname) []:Cowman.ip Email Address []:cowman.chiang@gmail.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: #可以直接按enter忽略 An optional company name []: #可以直接按enter忽略 |
cat csr,將資料丟到憑證申請的網站輸入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
[root@Web test]# cat site.csr #將以下的資料複製,貼至申請的網站 -----BEGIN CERTIFICATE REQUEST----- MIIC1DCCAbwCAQAwgY4xCzAJBgNVBAYTAlRXMQ8wDQYDVQQIEwZUYWl3YW4xFDAS BgNVBAcTC1RhaXBlaSBDaXR5MQ8wDQYDVQQKEwZDb3dtYW4xCzAJBgNVBAsTAklU MRIwEAYDVQQDEwlDb3dtYW4uaXAxJjAkBgkqhkiG9w0BCQEWF2Nvd21hbi5jaGlh bmdAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuUwx YtxHedYFykUgJuhtKGF0UuzPZ195QW9imVbFy0hT3Qt9YLKrmVESTFXxcdcLI6ty uSB3kZbnsOBr7XgGezso/lsY3dEprUplyYOXkKZsYXl7n4l7KU7nf7siGW0QY6xS oq1+7IIWa7Z9sKfdYUU9BsmH4c3YduuTa4WKdhOtn1RfSmqr5Gt+i35WZXc2/NUo efTHqsTmICh26eLjCmqrjgLfnSK9FpSa5q7nKbvK9s5q9Qae3vpECgJRf1klP1cS kBUTBoa6f46Wx+nWG/+QFpsW95w84RxxAIuUsTW2VcG6Ay6Q8TDEncj7iQ0TpJnh M3BCaepcnRVB7pNmYQIDAQABoAAwDQYJKoZIhvcNAQEFBQADggEBACmQWu30vr1v UuFxszR6ZUC3e25EEwCNg5UNh8iG9abauiE2K7l9lVWPicYdoZ1GjWGT13zMslwC 4c8nxvBKZfh4QGw5ALJvb1SZhvO/OMjPGCfQjuWRza44nNaaKi+BtCVHtglqvxTP EXpCODWd+E9x5NCzKyXLGXJpT3rDg4Ov1QaGNMtNByQLD+SgsoTR+yS+RcxwS11Y Ul26LrxnrbUvkwMV0/OWvbNREKSv3RsfjMWVsAtVwmdkRKlUNAFXMIOvAwmSImd/ +0ya5gEv4M+JVWWYy6vEnUOV333eR9tR4eCw7YO862TFdic9+4OPhVFpKeWJLANz wQ4uUOWkuPA= -----END CERTIFICATE REQUEST----- |
以namecheap的comodo憑證為例,選擇伺服器為 apache + mod_ssl,會回傳兩個檔案至mail中 cowman_ip.ca-bundle cowman_ip.crt 安裝mod_ssl
1 |
yum install mod_ssl |
取消需要輸入phase的機制
1 2 3 |
[root@Web test]# openssl rsa -in site.key -out site-nopass.key Enter pass phrase for roamingcenter_tanet_edu_tw.key: writing RSA key |
編輯 apache 設定檔,範例是在 /etc/httpd/conf.d/ssl.conf
1 2 3 4 5 6 7 |
[root@Web test]# vim /etc/httpd/conf.d/ssl.conf <VirtualHost _default_:443> SSLEngine on SSLCertificateFile /etc/httpd/certs/cowman_ip.crt SSLCertificateKeyFile /etc/httpd/certs/site-nopass.key SSLCertificateChainFile /etc/httpd/certs/cowman_ip.ca-bundle |
將 http 轉至 https,修改 /etc/httpd/conf/httpd.conf
1 2 3 4 5 6 |
[root@Web test]# vim /etc/httpd/conf/httpd.conf #加在最後面 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} |
重新啟動 apache
1 |
service httpd restart |
!! 記得檢查iptables防火牆設定
Posted in Apache, CentOS, SSL
Leave a comment
使用GMail SMTP寄信 – ssmtp (CentOS)
yum install ssmtp vim /etc/ssmtp/ssmtp.conf root=username@gmail.com mailhub=smtp.gmail.com:587 RewriteDomain= Hostname=username@gmail.com UseSTARTTLS=yes AuthUser=username@gmail.com AuthPass=password FromLineOverride=YES TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt alternatives –config mta 選擇 /usr/sbin/sendmail.ssmtp 檢查目前sendmail方式 sendmail -V sSMTP 2.61 (Not sendmail at all) 測試 echo “This is a test” | mail -s “Test” cowman.chiang@gmail.com Reference … Continue reading
Posted in CentOS
Leave a comment
使用GMail SMTP寄信 – command (CentOS)
近來發現diary log幾乎都收不到了 測試了一下, 發現連手動執行script都失敗 所以想一下就改用GMail SMTP應該比較保險 Reference: 在 Linux 上直接用 Gmail SMTP 寄信 yum install mailx vim ~/.mailrc account gmail { set smtp-use-starttls set smtp=smtp://smtp.gmail.com:587 set smtp-auth=login set smtp-auth-user=username@gmail.com set smtp-auth-password=password set from=”username@gmail.com” set ssl-verify=ignore set nss-config-dir=/root/.pki/nssdb set nss-config-dir=/etc/pki/nssdb } … Continue reading
Posted in CentOS
Leave a comment
CentOS 快速安裝 Nginx with RTMP module
跟 之前裝在Ubuntu的那一篇 一樣 都是沒有設定stat的部分, 需要在另外修改 大致上跟Ubuntu的方式都相同 只是要注意的為 init script 可不可正常進行 測試的範例中是修改 nginx.conf 將 pid 那一行給取消註腳
1 |
pid logs/nginx.pid; |
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 yum groupinstall 'Development Tools' -y yum install pcre pcre-devel openssl-devel libxslt-devel -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 yum 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 /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/RedHatNginxInitScript 中的檔案至 nignx 中 cd /etc/init.d/ vim nginx chmod +x nginx service nginx start # service nginx start|stop|reload |
Posted in CentOS, Nginx, RTMP
Leave a comment
Resize Virtual Disk – VMware ESXi 4.1 & CentOS 5.5 x86
使用vSphere Client登入調整硬體的設定,將硬碟空間增大 (由20G -> 80G) 將VM Guest重開機 以ssh登入VM Guest 輸入fdisk -l取得目前磁碟資訊
1 2 3 4 5 6 7 8 9 |
[root@localhost ~]# fdisk -l Disk /dev/sda: 85.8 GB, 85899345920 bytes 255 heads, 63 sectors/track, 10443 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 2610 20860402+ 8e Linux LVM |
根據4回傳的資訊,輸入fdisk /dev/sda
1 2 3 4 5 6 7 8 9 10 |
[root@localhost ~]# fdisk /dev/sda The number of cylinders for this disk is set to 10443. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): |
[備註] Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known … Continue reading
Posted in CentOS, VMware
Leave a comment