/Installer

各種 インストール用スクリプト

Primary LanguageShell

Installer Scripts

サーバー初期化用のスクリプト

Cent Default init

yum install -y wget && wget "https://raw.github.com/m-s-modified/Installer/master/cent.sh" -O /tmp/cent.sh && sh /tmp/cent.sh

公開鍵を追加

curl https://github.com/m-s-modified.keys >> ~/.ssh/authorized_keys

Apache

wget "https://raw.github.com/m-s-modified/Installer/master/apache.sh" -O /tmp/apache.sh && sh /tmp/apache.sh

作業ユーザーの追加

useradd -g apache $USERNAME
passwd $USERNAME
echo "umask 002" >> /home/$USERNAME/.bashrc
ln -s /var/www/$DOMAIN_NAME/public/ /home/$USERNAME/public
chown $USERNAME:$USERNAME /home/$USERNAME/public

vi /etc/ssh/sshd_config
# Subsystem       sftp    /usr/libexec/openssh/sftp-server –u 002
Subsystem sftp internal-sftp -u 0002

/etc/init.d/sshd restart

Apache VirtualHost

wget "https://raw.github.com/m-s-modified/Installer/master/vhost.sh" -O /tmp/vhost.sh && sh /tmp/vhost.sh

# 簡易版
wget "https://raw.github.com/m-s-modified/Installer/master/vhost.light.sh" -O vhost.light.sh

Apache deflate

wget "https://raw.github.com/m-s-modified/Installer/master/deflate.sh" -O /tmp/deflate.sh && sh /tmp/deflate.sh

Apache LTSV

wget "https://raw.github.com/m-s-modified/Installer/master/ltsv.sh" -O /tmp/ltsv.sh && sh /tmp/ltsv.sh
vi /etc/httpd/conf.d/ltsv.conf

MySql

wget "https://raw.github.com/m-s-modified/Installer/master/mysql.sh" -O /tmp/mysql.sh && sh /tmp/mysql.sh

初期設定

mysql_secure_installation

Mysql UserAdd

wget "https://raw.github.com/m-s-modified/Installer/master/mysql_user.sh" -O /tmp/mysql_user.sh && sh /tmp/mysql_user.sh

PHP

wget "https://raw.github.com/m-s-modified/Installer/master/php.sh" -O /tmp/php.sh && sh /tmp/php.sh

WordPress

sudo wget https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/bin/wp
sudo chmod +x /usr/bin/wp

cd DOCUMENT_ROOT

wp core download --locale=ja

wp core config \
    --dbhost=$DBHOST \
    --dbname=$DBNAME \
    --dbuser=$DBUSER \
    --dbpass=$DBPASS
 
wp core install \
    --url=$SITE_DOMAIN \
    --title=$SITE_TITLE \
    --admin_name=$ADMIN_NAME \
    --admin_email=admin@example.com \
    --admin_password=password 

FTP設定

wp-config.php に追記

define('FS_METHOD', 'direct');

パーミッション設定

wp-config.php に追記

define('FS_CHMOD_DIR', 0775);
define('FS_CHMOD_FILE', 0664);

Chroot

wget "https://raw.github.com/m-s-modified/Installer/master/chroot.sh" -O /tmp/chroot.sh && sh /tmp/chroot.sh

Memcached

wget "https://raw.github.com/m-s-modified/Installer/master/memcached.sh" -O /tmp/memcached.sh && sh /tmp/memcached.sh

AWS EC2

パスワードによるログインを許可

sed -i -e 's#PasswordAuthentication no#PasswordAuthentication yes#g' /etc/ssh/sshd_config
/etc/init.d/sshd restart

TimeZone 変更

sudo cp /usr/share/zoneinfo/Japan /etc/localtime

HealthCheck

cat << EOS  > /etc/httpd/conf.d/healthcheck.conf
    Alias /healthcheck /var/www/healthcheck
EOS

mkdir /var/www/healthcheck
cat << EOS  > /var/www/healthcheck/index.php
<?php
echo "success";
?>
EOS

.htaccess

SetEnvIf X-Forwarded-For "xxx.xxx.xxx.xxx" allowedip
Allow from env=allowedip

PhpMyAdmin

yum --enablerepo=remi install phpMyAdmin

config

vi /etc/httpd/cond.d/phpMyAdmin.conf
# アクセス制限を調整

Nginx

yum --enablerepo=epel -y install nginx

/etc/init.d/nginx start
chkconfig nginx on
chkconfig --list

http://qiita.com/kidachi_/items/985efebba639713c562e

FTP

wget "https://raw.github.com/m-s-modified/Installer/master/ftp.sh" -O /tmp/ftp.sh && sh /tmp/ftp.sh

Nikto

cd /usr/local/src/
wget http://www.cirt.net/nikto/nikto-current.tar.gz
tar zxvf nikto-current.tar.gz
cd nikto-2.1.5
perl nikto.pl -update

# Run
perl nikto.pl -host http://localhost

Munin

https://gist.github.com/m-s-modified/3936605