`
wuhuizhong
  • 浏览: 668004 次
  • 性别: Icon_minigender_1
  • 来自: 中山
社区版块
存档分类
最新评论

在RHEL上安裝設置常用服務(ftp,smb,ror+nginx)

阅读更多

---------------------------------------------------------------------------
設置ftp服务
查找vsftpd有没有安装
# rpm -qa|grep vsftpd

安装rpm:
# mount /dev/cdrom /mnt
# rpm -ivh /mnt/Server/vsftpd-2.0.1-8.el4.x86_64.rpm

将防火墙和SELinux停用
1.停用防火墙
# iptables -F
# service iptables stop
2.编辑/etc/selinux/config将SELINUX设为disabled,即SELINUX=disabled
3.客戶端瀏覽器連線設置:
IE不使用Proxy:192.168.*.*
FF直接連線:192.168.151.1/200

启动vsftpd服务
# service vsftpd start

所有的启动级别都自动启动vsftpd服务
chkconfig vsftpd on

匿名方式访问该ftp
文件目录:/var/ftp

---------------------------------------------------------------------------
設置SAMBA服務
查看是否安装:
# rpm -qa|grep samba
system-config-samba-1.2.21-1.el4.1.0.1
samba-common-3.0.33-0.17.el4
samba-3.0.33-0.17.el4
samba-client-3.0.33-0.17.el4

共享权限设计实现及用户和目录建立
要求:
gcmsadm     有管理所有空间的权限,并有自已的私有目录。
gcmsusr      有一个自已的私有空间。
share目录     所有用户只读目录(含匿名)。
user目录     user组用户可读写目录
建立相关用户和用户组
#groupadd gcmsadm;groupadd gcmsusr
建立相关用户
#useradd -g gcmsusr -d /var/ftp/gcms_apps -s /sbin/nologin gcmsusr
#useradd -g gcmsadm -G gcmsadm,gcmsusr -d /var/ftp/gcms_apps -s /sbin/nologin gcmsadm
建立相关目录
#mkdir /var/ftp/gcms_apps

目录权限设计
#chmod 755 /var/ftp/gcms_apps;chown gcmsadm.gcmsadm /var/ftp/gcms_apps

添加samba用户,并设置密码
#cp /etc/samba/passdb.tdb /etc/samba/passdb.tdb.bak
#smbpasswd -a gcmsadm
New SMB password:admgcms
Retype new SMB password:admgcms
……
重复上面的操作,把gcmsusr(密碼usrgcms)都添加进去。
查看用户和密码是否添加进去。
#pdbedit -L -w

配置:
# vi /etc/samba/smb.conf

启动服务:
# service smb start

所有的启动级别都自动启动smb服务
chkconfig smb on

------------------------------------------------------------------------------
安装ruby-enterprise
參考: http://www.rubyenterpriseedition.com/documentation.html#_manual_installation_for_experts

root用戶登錄:
# cd /var/tmp
# tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
# chown -R oracle /opt
oracle用戶登錄
$ vi .profile.custom.noninteractive
加入兩行:
export PATH=/opt/ruby-enterprise/bin:$PATH
export PREFIX=/opt/ruby-enterprise

oracle用戶重新登錄手動安裝
$ cd /var/tmp
$ PREFIX=/opt/ruby-enterprise
$ cd ruby-enterprise-1.8.7-2010.02/source
$ patch -p1 -R < ../fast-threading.patch
$ cd ../..
$ cd ruby-enterprise-1.8.7-2010.02/source/distro/google-perftools-*
$ ./configure --prefix=$PREFIX --disable-dependency-tracking
$ make libtcmalloc_minimal.la
$ cd ../..
$ ./configure --prefix=$PREFIX --enable-mbari-api CFLAGS='-g -O2'
$ make PRELIBS="-Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -ltcmalloc_minimal"
$ make install


完成以上手動安裝再執行:
$ ./installer -c --enable-shared
--------------------------------------------
Warning: some libraries could not be installed
The following gems could not be installed, probably because of an Internet
connection error:

 * mysql -- --with-mysql-config='/usr/bin/mysql_config'
 * sqlite3-ruby
 * pg

These gems are not required, i.e. Ruby Enterprise Edition will work fine without them. But most people use Ruby Enterprise Edition in combination with Phusion Passenger and Ruby on Rails, which do require one or more of the aforementioned gems, so you may want to install them later.

To install the aforementioned gems, please use the following commands:
  * /opt/ruby-enterprise/bin/ruby /opt/ruby-enterprise/bin/gem install mysql -- --with-mysql-config='/usr/bin/mysql_config'
  * /opt/ruby-enterprise/bin/ruby /opt/ruby-enterprise/bin/gem install sqlite3-ruby
  * /opt/ruby-enterprise/bin/ruby /opt/ruby-enterprise/bin/gem install pg

Press ENTER to show the next screen.
Updating /opt/ruby-enterprise/bin/thor...
Updating /opt/ruby-enterprise/bin/rails...
Updating /opt/ruby-enterprise/bin/passenger-install-apache2-module...
Updating /opt/ruby-enterprise/bin/passenger-stress-test...
Updating /opt/ruby-enterprise/bin/rake...
Updating /opt/ruby-enterprise/bin/rdoc...
Updating /opt/ruby-enterprise/bin/rake2thor...
Updating /opt/ruby-enterprise/bin/rackup...
Updating /opt/ruby-enterprise/bin/bundle...
Updating /opt/ruby-enterprise/bin/passenger-memory-stats...
Updating /opt/ruby-enterprise/bin/irb...
Updating /opt/ruby-enterprise/bin/passenger-spawn-server...
Updating /opt/ruby-enterprise/bin/passenger-status...
Updating /opt/ruby-enterprise/bin/erubis...
Updating /opt/ruby-enterprise/bin/gem...
Updating /opt/ruby-enterprise/bin/erb...
Updating /opt/ruby-enterprise/bin/testrb...
Updating /opt/ruby-enterprise/bin/passenger-config...
Updating /opt/ruby-enterprise/bin/passenger-make-enterprisey...
Updating /opt/ruby-enterprise/bin/passenger-install-nginx-module...
Updating /opt/ruby-enterprise/bin/tt...
Updating /opt/ruby-enterprise/bin/ri...
chmod -R g+r,o+r,o-w sqlite3-ruby*
--------------------------------------------
Ruby Enterprise Edition is successfully installed!
If want to use Phusion Passenger (http://www.modrails.com) in combination
with Ruby Enterprise Edition, then you must reinstall Phusion Passenger against
Ruby Enterprise Edition, as follows:

  /opt/ruby-enterprise/bin/passenger-install-apache2-module

Make sure you don't forget to paste the Apache configuration directives that
the installer gives you.


If you ever want to uninstall Ruby Enterprise Edition, simply remove this
directory:

  /opt/ruby-enterprise

If you have any questions, feel free to visit our website:

  http://www.rubyenterpriseedition.com

Enjoy Ruby Enterprise Edition, a product of Phusion (www.phusion.nl) :-)

------------------------------------------------------------------------------
配置nginx
$ /opt/ruby-enterprise/bin/passenger-install-nginx-module
Welcome to the Phusion Passenger Nginx module installer, v2.2.15.

This installer will guide you through the entire installation process. It
shouldn't take more than 5 minutes in total.

Here's what you can expect from the installation process:

 1. This installer will compile and install Nginx with Passenger support.
 2. You'll learn how to configure Passenger in Nginx.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.
--------------------------------------------

Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /opt/ruby-enterprise/bin/rake
 * rack... found
 * OpenSSL development headers... found
 * Zlib development headers... found

--------------------------------------------

Automatically download and install Nginx?

Nginx doesn't support loadable modules such as some other web servers do,
so in order to install Nginx with Passenger support, it must be recompiled.

Do you want this installer to download, compile and install Nginx for you?

 1. Yes: download, compile and install Nginx for me. (recommended)
    The easiest way to get started. A stock Nginx 0.7.67 with Passenger
    support, but with no other additional third party modules, will be
    installed for you to a directory of your choice.

 2. No: I want to customize my Nginx installation. (for advanced users)
    Choose this if you want to compile Nginx with more third party modules
    besides Passenger, or if you need to pass additional options to Nginx's
    'configure' script. This installer will  1) ask you for the location of
    the Nginx source code,  2) run the 'configure' script according to your
    instructions, and  3) run 'make install'.

Whichever you choose, if you already have an existing Nginx configuration file,
then it will be preserved.

Enter your choice (1 or 2) or press Ctrl-C to abort: 1
--------------------------------------------

Where do you want to install Nginx to?

Please specify a prefix directory [/opt/nginx]:
--------------------------------------------

Nginx with Passenger support was successfully installed.

The Nginx configuration file (/opt/nginx/conf/nginx.conf)
must contain the correct configuration options in order for Phusion Passenger
to function correctly.

This installer has already modified the configuration file for you! The
following configuration snippet was inserted:

  http {
      ...
      passenger_root /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.15;
      passenger_ruby /opt/ruby-enterprise/bin/ruby;
      ...
  }

After you start Nginx, you are ready to deploy any number of Ruby on Rails
applications on Nginx.

Press ENTER to continue.
--------------------------------------------

Deploying a Ruby on Rails application: an example

Suppose you have a Ruby on Rails application in /somewhere. Add a server block
to your Nginx configuration file, set its root to /somewhere/public, and set
'passenger_enabled on', like this:

   server {
      listen 80;
      server_name www.yourhost.com;
      root /somewhere/public;   # <--- be sure to point to 'public'!
      passenger_enabled on;
   }

And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:

  /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.15/doc/Users guide Nginx.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.


---------------------------------------------------------------------------
HTTP服務目錄
服務器端創建目錄:
# ln -s /var/ftp/gcms_apps /opt/nginx/html/gcms_apps
# chmod -R 755 /var/ftp/gcms_apps
# cp /opt/nginx/html/index.html nginx/html/gcms_apps/index.html
客戶端瀏覽器連線設置:
IE不使用Proxy:192.168.*.*
FF直接連線:192.168.151.1/200

------------------------------------------------------------------------------
設置 start and stop nginx with init script:
git clone git://github.com/xdite/rails-nginx-passenger-centos.git
mv rails-nginx-passenger-centos/nginx/nginx /etc/init.d/nginx
chown root:root /etc/init.d/nginx
chmod +x /etc/init.d/nginx
/etc/init.d/nginx start
/etc/init.d/nginx status
/etc/init.d/nginx stop
所有的启动级别都自动启动nginx服务
/sbin/chkconfig nginx on

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics