搜尋此網誌

2015年6月24日 星期三

RedHat/CentOS 關閉 SELINUX

編輯 /etc/sysconfig/selinux 這個檔案

將 SELINUX=enforcing 改成 SELINUX=disabled ,

重開機就可以了!

2015年6月21日 星期日

註冊 Redhat Linux

subscription-manager register

Username: email adress
Password: password
The system has been registered with ID: 8d1eef8f-f44a-42bd-b423-4197c3c20082

再次執行 yum,若出現如下指令表示已經註冊但還沒有套用可用的授權訂閱。

Loaded plugins: product-id, security, subscription-manager
This system is registered to Red Hat Subscription Management, but is not receiving updates. You can

use subscription-manager to assign subscriptions.
Setting up Update Process
No Packages marked for Update



查看可用訂閱。
subscription-manager list --available

[root@localhost tmp]# subscription-manager list --available
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: 30 Day Red Hat Enterprise Linux Server Self-Supported Evaluation
Provides:          Red Hat Container Images Beta
                   Red Hat Beta
                   Red Hat Enterprise Linux Atomic Host Beta
                   Oracle Java (for RHEL Server)
                   Red Hat Container Images
                   Red Hat Enterprise Linux Server
                   Red Hat Enterprise Linux Atomic Host
SKU:               RH00065
Contract:          10719296
Pool ID:           8a85f9814df266ee014dfb931cfc2854
Available:         2
Suggested:         1
Service Level:     Self-Support
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              07/16/2015
System Type:       Physical




使用 subscribe 參數訂閱可用的 Pool。


subscription-manager subscribe --pool=8a85f9814df266ee014dfb931cfc2854

Successfully attached a subscription for: 30 Day Red Hat Enterprise Linux Server Self-Supported

Evaluation


完成!




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 確認版本

搜尋此網誌