搜尋此網誌

2015年5月15日 星期五

讓 VsFTPd 允許 root 登入


因為Linux 預設不讓任何軟體隨意進出root 這個資料匣,但因為要讓root使用ftp ,所以需要以下指令開放:

setsebool -P allow_ftpd_full_access  on

使用vi 編輯器,編輯 /etc/vsftpd 裡面的 ftpusers 及 user_list  兩個檔案。
將 root 前面都加上 “#”

重新啟動 vsftpd


2015年5月3日 星期日

CentOS / RHEL 7: Install GCC (C and C++ Compiler) and Development Tools

Source: http://www.cyberciti.biz/faq/centos-rhel-7-redhat-linux-install-gcc-compiler-development-tools/

先檢查本機是否有安裝開發套件:
# yum group list


如果畫面上條列出來,Available Groups 內缺乏
Development Tools 的話,參照以下指令,以 root 身份安裝 開發套件

Type the following [nixcmd name="yum" as root user:
# yum -y group install "Development Tools" 

OR

$ sudo yum -y group install "Development Tools" 
If above command failed, try:
# yum -y groupinstall "Development Tools"




2015年4月27日 星期一

Install Nginx on CentOS 7

Source:https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-centos-7

sudo yum install nginx

sudo systemctl enable nginx.service
sudo systemctl start nginx.service

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

http://server_domain_name_or_IP/

###
Default Server Root
/etc/nginx/conf.d/default.conf

Server Block Configuration
/etc/nginx/conf.d

Nginx Global Configuration
/etc/nginx/nginx.conf

Installing Node.js via package manager

Source:
http://www.unixmen.com/install-node-js-centos-7/

epel’s repo 要事先安排好,如果沒有可以參照以下:
wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/e/

rpm -hiv epel-release-7-5.noarch.rpm
會在 /etc/yum.repos.d 底下建立兩個 epel’s repo 檔案  



yum -y install npm

yum -y install nodejs

安裝好 nodejs 之後
編輯一個文字檔,進行測試

vi hello.js

var http = require('http');
http.createServer(function (request, response) {
 response.writeHead(200, {'Content-Type': 'text/plain'});
 response.end('Hello World\n');
 }).listen(8080);

console.log('Server started');
存檔

執行
node hello.js

打開瀏覽器
http://127.0.0.1:8080
看到 Hello World 即可。

node -v 確認版本



另一種安裝方法:

wget http://nodejs.org/dist/v0.10.30/node-v0.10.30-linux-x64.tar.gz

tar xzvf node-v* && cd node-v*

sudo yum install gcc gcc-c++

./configure
make

node --version 確認版本

How to install redis server on CentOS 7 / RHEL 7

Source: http://sharadchhetri.com/2014/10/04/install-redis-server-centos-7-rhel-7/

wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/e/

rpm -hiv epel-release-7-5.noarch.rpm
會在 /etc/yum.repos.d 底下建立兩個 epel’s repo 檔案  

接下來

yum -y install redis

systemctl enable redis.service
systemctl start redis.service

systemctl status redis.service

redis-cli  ping

ss -nlp | grep redis

Install MongoDB on Red Hat Enterprise, CentOS, or Fedora

Source:http://docs.mongodb.org/v2.2/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/

vi /etc/yum.repos.d/mongodb.repo
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

yum -y install mongo-10gen mongo-10gen-server

chkconfig mongod on

service mongod start
#systemctl start mongod.service

Install xrdp Remote Desktop to CentOS 7 / RHEL 7

Source:http://www.itzgeek.com/how-tos/linux/centos-how-tos/install-xrdp-on-centos-7-rhel-7.html#axzz3YU1wZCpw

新增社群維運套件庫補官方套件之不足。

= 7 =
rpm -Uvh http://mirror01.idc.hinet.net/EPEL/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

rpm -ivh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org


= 6 =
rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm



編輯 xrdp.repo
vi /etc/yum.repos.d/xrdp.repo

[xrdp]
name=xrdp
baseurl=http://li.nux.ro/download/nux/dextop/el7/x86_64/
enabled=1
gpgcheck=0


安裝 Installation:
yum -y install pixman libXfont xrdp tigervnc-server

以下兩個動作 很重要:
chcon --type=bin_t /usr/sbin/xrdp
chcon --type=bin_t /usr/sbin/xrdp-sesman

如果失敗了,先下以下指令
ls -Z /usr/sbin
找到 xrdp 等檔案,發現有 ? 符號
以下列指令修改屬性,例如:
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp-chansrv
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp-sesman
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp-sessvc

然後再檢查一次,
ls -Z /usr/sbin
直到都沒有 ? 符號,成功之後,再回頭下剛剛那兩個指令

接下來,編輯 vi /etc/xrdp/sesman.ini
找到 [Xnvc] 這一段,加入以下:

param7=-depth
param8=24

確定 param 數字號碼是連續的。


要修改 xrdp 對外服務的 PORT 號碼則
vi /etc/xrdp/xrdp.ini
改掉 3389 的值

檔案最尾巴加入以下:
[xrdp8]
name=Reconnect
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=5910



啟動服務:
systemctl stop firewalld
systemctl disable firewalld
systemctl enable xrdp.service
systemctl start xrdp.service



防火牆如果需要打洞3389
firewall-cmd --permanent --zone=public --add-port=3389/tcp
firewall-cmd --reload


- END -

搜尋此網誌