さくらVPSのCentOSにjettyをインストール
CentOS 6.4
jetty 9.0.6
参考
http://gari-dev.blogspot.jp/2013/01/centosjetty.html
http://gari-dev.blogspot.jp/2013/01/centosjettydaemon.html
http://www.eclipse.org/jetty/documentation/current/setuid.html
jettyをダウンロード
jetty-distribution-9.0.6.v20130930.tar.gzをダウンロード。
wgetで普通の取得しようとすると失敗するので、ブラウザで手元の端末に落としてからVPSに送信。
rootになって/usr/local/srcに配置。
jetty用ユーザ作成
useradd jetty -G jetty -s /bin/false
jettyを展開
# 展開 tar xvzf jetty-distribution-9.0.6.v20130930.tar.gz # /usr/locaに移動 mv jetty-distribution-9.0.6.v20130930 /usr/local/jetty-distribution-9.0.6.v20130930 # 所有者をjettyに変更 cd /usr/local chown -R jetty:jetty jetty-distribution-9.0.6.v20130930 # シンボリックリンク作成 ln -s jetty-distribution-9.0.6.v20130930/ jetty chown
jettyがjettyユーザで実行されるように設定
/usr/local/jetty/start.ini
etc/jetty-setuid.xml 略 #=========================================================== # Enable SetUID # The default user and group is 'jetty' and if you are # starting as root you must change the run privledged to true #----------------------------------------------------------- OPTIONS=setuid
/usr/local/jetty/etc/jetty-setuid.xml
- jettyの起動ユーザを指定
- デフォルトでこれなので、jettyユーザで動かす場合は修正の必要なし
<Set name="username"><Property name="jetty.username" default="jetty"/></Set> <Set name="groupname"><Property name="jetty.groupname" default="jetty"/></Set>
jettyのデーモン化
http://gari-dev.blogspot.jp/2013/01/centosjettydaemon.htmlから起動スクリプトをいただき、/etc/init.d/jettyで保存。
サービスに登録して起動。
# サービスに登録 chkconfig --add /etc/init.d/jetty # 起動 service jetty start