Help us understand the problem. What is going on with this article?

サーバーの初期設定用スクリプトをDropBoxで管理

More than 5 years have passed since last update.

面倒なサーバーの設定を可能な限り自動化。
自動設定用のスクリプトをDropBox(じゃなくても良いけど)に置いといて、DLしてからそのまま実行する。

例としてWordPressのインストール。

wordpress.sh
#!/bin/sh# WordPressecho "Enter database name"read DATABASE_NAME;echo "Enter mysql user name:"read MYSQL_USER;echo "Enter $MYSQL_USER's password:"read MYSQL_PASSWORD;echo "Enter MySQL root passowrd:"cat << EOS | mysql -u root -pCREATE USER $MYSQL_USER;CREATE DATABASE $DATABASE_NAME;GRANT ALL PRIVILEGES ON $DATABASE_NAME.* TO "$MYSQL_USER"@"localhost" IDENTIFIED BY "$MYSQL_PASSWORD";FLUSH PRIVILEGES;EOS# 最新版の取得wget -P /tmp/ http://ja.wordpress.org/latest-ja.tar.gztar zxvf /tmp/latest-ja.tar.gz -C /tmp/echo "Enter install dir"read INSTALL_DIRmkdir -p $INSTALL_DIRmv /tmp/wordpress/* $INSTALL_DIRchown -R apache:apache $INSTALL_DIR```

あとはこのファイルをDropBoxかなんかに上げておいて、リンクの取得。

```bash
$ wget https://dl.dropbox.com/xxxxx/wordpress.sh?dl=1 -O /tmp/wordpress.sh && sh /tmp/wordpress.sh```

と、rootで呼び出せばそのまま実行されるハズ。
( 一度tmpに保存しているのは、パイプだとreadコマンドが上手く動かなかったから )
あとは使いながら改善という事で。。
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away