centos


Menu

1 centos6 setup

1-1 java install

  • move local
cd /usr/local/
  • uninstall
rpm -e jdk-7u80-linux-x64.rpm
rpm -e jdk-8u121-linux-x64.rpm
  • install
rpm -ivh jdk-7u80-linux-x64.rpm
rpm -ivh jdk-8u121-linux-x64.rpm
  • change link
wget https://github.com/git/git/archive/v2.12.2.tar.gz
  • add java
alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_18/bin/java 16018
  • alternatives change
alternatives --config java

1-2 tomcat install

  • move local
cd /usr/local/
  • download
wget http://ftp.jaist.ac.jp/pub/apache/tomcat/tomcat-7/v7.0.77/bin/apache-tomcat-7.0.77.tar.gz
  • change mode
chmod 755 /usr/local/apache-tomcat-7.0.77.tar.gz
  • expansion
tar -xvf /usr/local/apache-tomcat-7.0.77.tar.gz
  • symbolic link
ln -s /usr/local/apache-tomcat-7.0.77 tomcat
  • /etc/rc.d/init.d/tomcat
#!/bin/bash
#
# Startup script for the Tomcat Servlet Container
#
# chkconfig: 2345 35 65
# description: Tomcat is the servlet container that is used in the official \
#              Reference Implementation for the Java Servlet and JavaServer \
#              Pages technologies

TOMCAT_USER=tomcat
CATALINA_HOME=/usr/local/tomcat

. /etc/rc.d/init.d/functions
prog=tomcat

start() {
    echo -n $"Starting $prog: "
    daemon --user $TOMCAT_USER $CATALINA_HOME/bin/startup.sh > /dev/null
    RETVAL=$?
    if [ $RETVAL -eq 0 ]; then
        echo_success
    else
        echo_failure
    fi
    echo
    [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
    return $RETVAL
}
stop() {
    echo -n $"Stopping $prog: "
    daemon --user $TOMCAT_USER $CATALINA_HOME/bin/shutdown.sh > /dev/null
    RETVAL=$?
    if [ $RETVAL -eq 0 ]; then
        echo_success
    else
        echo_failure
    fi
    echo
    [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog
    return $RETVAL
}

# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    ;;
  status)
    INSTANCES=`ps --columns 512 -aef|grep java|grep tomcat|grep org.apache.catalina.startup.Bootstrap|wc -l`
    if [ $INSTANCES -eq 0 ]; then
        echo $prog is stopped
        RETVAL=3
    else
        if [ $INSTANCES -eq 1 ]; then
            echo $prog is running 1 instance...
        else
            echo $prog is running $INSTANCES instances...
        fi
        RETVAL=0
    fi
    ;;
  *)
    echo $"Usage: $prog {start|stop|restart|status|help}"
    exit 1
esac

exit $RETVAL
  • auto run setting
/sbin/chkconfig --add tomcat

1-3 apache tomcat setting

  • vi /etc/httpd/conf.d/proxy_ajp.conf
ProxyPass /examples/ http://hostname:8080/examples/
  • acess test
http://183.181.52.78:8080/examples/

1-4 git install

  • download
wget https://www.kernel.org/pub/software/scm/git/git-2.9.3.tar.gz
  • expansion
tar -xvf git-2.9.3.tar.gz
  • install
yum install gcc
yum install zlib
yum install zlib-devel
yum install perl-ExtUtils-MakeMaker
./configure --prefix=/usr/local/
make
make install
which git
git --version
  • update settings
cd /usr/local/src/
git clone git://git.kernel.org/pub/scm/git/git.git
  • update
cd git
make prefix=/usr/local all
make prefix=/usr/local install
git --version

1-4 git server

  • install
yum install git git-deamon git-all xinetd
chkconfig xinetd on
/etc/init.d/xinetd start
touch /etc/xinetd.d/git-daemon
  • vi /etc/xinetd.d/git-daemon
# default: off
# description: The git dæmon allows git repositories to be exported using \
#       the git:// protocol.

service git
{
       disable         = no      # <- 変更
       socket_type     = stream
       wait            = no
       user            = nobody
       server          = /usr/libexec/git-core/git-daemon
       server_args     = --base-path=/var/lib/git --export-all --user-path=public_git --syslog --inetd --verbose
       log_on_failure  += USERID
}
  • reflect
/etc/rc.d/init.d/xinetd restart
  • make git user
useradd gituser
passwd gituser
  • make git group
groupadd git
usermod -G git gituser
  • make secret key
ssh-keygen -t rsa
mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
  • make repositry
cd /var/lib/git
mkdir public_git
mkdir public_git/sample.git
cd public_git/sample.git
git --bare init --shared
  • repositry group set git group
chown -R root:git /var/lib/git

1-5 gitbucket install

  • check new version
https://github.com/gitbucket/gitbucket/releases
  • move tomcat webapp
cd /usr/local/tomcat/webapps
  • download (java8)
wget https://github.com/gitbucket/gitbucket/releases/download/4.11/gitbucket.war -P /usr/local/tomcat/webapps/
  • download (java7)
wget https://github.com/gitbucket/gitbucket/releases/download/3.10/gitbucket.war -P /usr/local/tomcat/webapps/
  • deploy
service tomcat stop
service tomcat start
  • vi /etc/httpd/conf.d/proxy_ajp.conf
ProxyPass /gitbucket/ http://hostname:8080/gitbucket/

1-6 samba install

  • install
yum -y install samba
  • make install dir
mkdir /usr/local/samba
  • vi mkhomedir.sh
#!/bin/bash

for user in `ls /home`
do
    id $user > /dev/null 2>&1
    [ $? -eq 0 ] && \
    [ ! -d /home/$user/samba ] && \
    mkdir /home/$user/samba && \
    chown $user:$user /home/$user/samba && \
    echo "/home/$user/samba create"
done
mkdir /home/samba
chown nobody:nobody /home/samba
  • vi /etc/samba/smb.conf
[global]
   unix charset = UTF-8 ← 追加(Linux側日本語文字コード)
   dos charset = CP932 ← 追加(Windows側日本語文字コード)

# workgroup = NT-Domain-Name or Workgroup-Name
   workgroup = MYGROUP
   ↓
   workgroup = WORKGROUP ← 変更(Windowsのワークグループ名を指定)
        ※マイコンピュータのプロパティ⇒コンピュータ名タブ内のワークグループ欄を参照

;   hosts allow = 192.168.1. 192.168.2. 127.
   hosts allow = 192.168.1. 127. ← 追加(内部からのみアクセスできるようにする)

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
;   load printers = yes ← 行頭に;を追加(プリンタ共有無効化)※Sambaでプリンタを共有しない場合
   load printers = no ← 追加(プリンタ共有無効化)※Sambaでプリンタを共有しない場合
   disable spoolss = yes ← 追加(プリンタ共有無効化)※Sambaでプリンタを共有しない場合

 [homes]
   comment = Home Directories
   path = %H/samba ← 追加(/home/ユーザー名/sambaをホームディレクトリにする)
   browseable = no
   writable = yes
   各ユーザー専用のごみ箱機能追加(ここから)
   ※ファイル削除時に自動的にごみ箱へ移動されるようにする
   vfs objects = recycle ← ごみ箱の有効化
   recycle:repository = .recycle ← ごみ箱のディレクトリ名(/home/ユーザー名/.recycle)
   recycle:keeptree = no ← ごみ箱へ移動時にディレクトリ構造を維持しない
   recycle:versions = yes ← 同名のファイルがごみ箱にある場合に別名で移動
   recycle:touch = no ← ごみ箱へ移動時にタイムスタンプを更新しない
   recycle:maxsize = 0 ← ごみ箱へ移動するファイルのサイズ上限(0:無制限)
   recycle:exclude = *.tmp ~$* ← ここで指定したファイルはごみ箱へ移動せずに即削除する
   各ユーザー専用のごみ箱機能追加(ここまで)

以下を最終行へ追加
[public]
   comment = Public Stuff
   path = /home/samba
   public = yes
   writable = yes
   only guest = yes
   共有ディレクトリのごみ箱機能追加(ここから)
   ※ファイル削除時に自動的にごみ箱へ移動されるようにする
   vfs objects = recycle ← ごみ箱の有効化
   recycle:repository = .recycle ← ごみ箱のディレクトリ名(/home/ユーザー名/.recycle)
   recycle:keeptree = no ← ごみ箱へ移動時にディレクトリ構造を維持しない
   recycle:versions = yes ← 同名のファイルがごみ箱にある場合に別名で移動
   recycle:touch = no ← ごみ箱へ移動時にタイムスタンプを更新しない
   recycle:maxsize = 0 ← ごみ箱へ移動するファイルのサイズ上限(0:無制限)
   recycle:exclude = *.tmp ~$* ← ここで指定したファイルはごみ箱へ移動せずに即削除する
   共有ディレクトリのごみ箱機能追加(ここまで)
  • samba start
/etc/rc.d/init.d/smb start
/etc/rc.d/init.d/nmb start
chkconfig smb on
chkconfig nmb on
※centos7↓
#systemctl start smb
#systemctl start nmb
#systemctl enable smb
#systemctl enable nmb

1-7 letsencrypt install

1-8 ssl setting


1-9 redmine install

1-* other settings

最新の20件

2021-11-01 2021-02-24 2021-02-22 2019-02-24 2017-04-07
  • centos
2017-04-03 2017-03-24

今日の2件

  • counter: 154
  • today: 1
  • yesterday: 0
  • online: 1