#!/bin/bash
#############################################
# Fuction: Install LNMP automaticlly. #
# Date: 2014-03-17 #
# Contact Infomation #
# Q: 303228632 #
# T: *********** #
# Designed by Pmghong #
#############################################
# Configuration Arguments
workpath="/usr/local/src"
install_path="/usr/local"
mysql="mysql-5.5.29"
php="php-5.4.11"
nginx="nginx-1.2.6"
# Install basic software
echo -e "\e[1;31m Installing basic software... \e[0m"
apt-get install -y gcc g++ make cmake
echo -e "\e[1;32m Complete \e[0m"
# Install mysql
echo -e "\e[1;31m Installing mysql... \e[0m"
apt-get install -y libncurses5-dev build-essential bison
groupadd mysql
useradd -r -g mysql mysql
cd ${workpath}
tar xf ${mysql}.tar.gz
cd ${mysql}
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ -DMYSQL_DATADIR=/usr/local/mysql/data -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock -DMYSQL_USER=mysql -DWITH_DEBUG=0
make && make install
echo -e "\e[1;32m Complete!!! \e[0m"
# Configure mysql
echo -e "\e[1;31m Confuring mysql... \e[0m"
cd ${install_path}/mysql
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
chown -R mysql.mysql .
cp support-files/my-medium.cnf /etc/my.cnf
sed -i "27i datadir = ${install_path}\/mysql\/data" /etc/my.cnf
sed -i "27i basedir = ${install_path}\/mysql" /etc/my.cnf
sed -i "27i user = mysql" /etc/my.cnf
sed -i "30i character_set_server = utf8" /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
sed -i "46s#basedir=#basedir=${install_path}\/mysql#" /etc/init.d/mysqld
sed -i "47s#datadir=#datadir=${install_path}\/mysql\/data#" /etc/init.d/mysqld
ln -s /usr/local/mysql/bin/* /usr/bin/
/etc/init.d/mysqld start
echo -e "\e[1;32m Complete!!! \e[0m"
# Install php
echo -e "\e[1;31m Installing php... \e[0m"
apt-get install -y libltdl-dev libssl-dev sendmail libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libxml2-dev libcurl4-openssl-dev libmcrypt-dev
cd ${workpath}
tar xf ${php}.tar.bz2
cd ${php}
./configure --prefix=/usr/local/php --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --with-curl --with-mcrypt --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-openssl --with-imap-ssl --with-gd --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/ --enable-exif --enable-zip
make && make install
cp php.ini-production /usr/local/php/lib/php.ini
cd ${install_path}/php/etc
cp -a php-fpm.conf.default php-fpm.conf
useradd -s /sbin/nologin -M fpmuser
${install_path}/php/sbin/php-fpm
echo -e "\e[1;32m Complete!!! \e[0m"
# Install nginx
echo -e "\e[1;31m Installing nginx... \e[0m"
apt-get install -y libpcre3 libpcre3-dev zlib1g-dev libncurses5-dev
useradd -s /sbin/nologin -M www
cd ${workpath}
tar xf ${nginx}.tar.gz
cd ${nginx}
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module
make && make install
ln -s /usr/local/nginx/sbin/nginx /etc/init.d/
/etc/init.d/nginx
echo -e "\e[1;32m Complete!!! \e[0m"
# Configure nginx
echo -e "\e[1;31m Configuringing nginx... \e[0m"
sed -i "s/#user nobody;/user www www;/" ${install_path}/nginx/conf/nginx.conf
IP=`ifconfig eth0|grep "\<inet\>"|cut -d':' -f2|sed -n 's/ Bcast//p'`
sed -i "37s/server_name localhost;/server_name ${IP};/" ${install_path}/nginx/conf/nginx.conf
sed -i '45s/index /& index.php/' ${install_path}/nginx/conf/nginx.conf
sed -i '65,71s/#//' ${install_path}/nginx/conf/nginx.conf
sed -i 's#\/scripts$fastcgi_script_name;#$document_root$fastcgi_script_name;#' ${install_path}/nginx/conf/nginx.conf
# Create a test page
cat << EOF >> ${install_path}/nginx/html/index.php
<?php
phpinfo();
?>
EOF
/etc/init.d/nginx -s reload
echo -e "\e[1;32m Totally Complete!!! Now you can test the LNMP system. \e[0m"#!/bin/bash
cat << EOF
##############################################################
# Welcome to AutoLNMP! #
# Fuction: This script will install LNMP automaticlly. #
# Date: 2014-03-19 #
# Contact Infomation #
# T: *********** #
# Designed by Pmghong #
##############################################################
Script is running please wait for a minune...
EOF
# Unzip packages
tar xPf nginx.tar.gz -C /usr/local/ 2> /dev/null
tar xPf mysql.tar.gz -C /usr/local/ 2> /dev/null
tar xPf php.tar.gz -C /usr/local/ 2> /dev/null
mkdir -p /usr/local/src/lib
tar xPf php_lib.tar.gz -C /usr/local/src/ 2> /dev/null
apt-get install expect -y > /dev/null 2>&1
# Add service users
groupadd mysql
useradd -r -g mysql mysql
useradd -s /sbin/nologin -M fpmuser
useradd -s /sbin/nologin -M www
# Configure Mysql
cd /usr/local/mysql
chown mysql.mysql . -R
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data > /dev/null
cp mysqld /etc/init.d/
ln -s /usr/local/mysql/bin/* /usr/bin/
# Start services
/usr/local/nginx/sbin/nginx
/etc/init.d/mysqld start > /dev/null
/usr/local/php/sbin/php-fpm
echo
echo "Work complete!"
echo "Now you can test the page 'http://IP'."
echo "If you want to install wordpress.Follow this step: 1.Run expect.sh. 2.Run LNMP_tester.sh"#!/usr/bin/expect
spawn mysqladmin -uroot password
expect "password:"
send "123456\r"
expect "password:"
send "123456\r"
interact#!/bin/bash
USER="root"
PASSWD="123456"
IP=`ifconfig eth0|grep "Bcast"|cut -d":" -f2|sed -n "s/ Bcast//p"`
tar xf wordpress-3.7.1-zh_CN.tar.gz
cd wordpress
cp -Ra * /usr/local/nginx/html/
cd /usr/local/nginx/html/
cp wp-config-sample.php wp-config.php
sed -i "s#define('DB_NAME', 'database_name_here');#define('DB_NAME', 'blog');#" /usr/local/nginx/html/wp-config.php
sed -i "s#define('DB_USER', 'username_here');#define('DB_USER', 'blogadmin');#" /usr/local/nginx/html/wp-config.php
sed -i "s#define('DB_PASSWORD', 'password_here');#define('DB_PASSWORD', '123456');#" /usr/local/nginx/html/wp-config.php
sed -i "s#define('DB_HOST', 'localhost');#define('DB_HOST', '$IP');#" /usr/local/nginx/html/wp-config.php
#WORKPATH=`pwd`
#exec ./{WORKPATH}expect.sh
mysql -u $USER -p$PASSWD <<EOF 2> /dev/null
create database blog;
grant all privileges on blog.* to blogadmin@'%' identified by '123456';
flush privileges;
EOF
[ $? -eq 0 ] && echo "OK" || echo "Error".
将这些文件打包起来,放到相同环境下,运行脚本即可快速部署上LNMP环境。(注:实验环境为Ubuntu 12.04)我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po
我打算为ruby脚本创建一个安装程序,但我希望能够确保机器安装了RVM。有没有一种方法可以完全离线安装RVM并且不引人注目(通过不引人注目,就像创建一个可以做所有事情的脚本而不是要求用户向他们的bash_profile或bashrc添加一些东西)我不是要脚本本身,只是一个关于如何走这条路的快速指针(如果可能的话)。我们还研究了这个很有帮助的问题:RVM-isthereawayforsimpleofflineinstall?但有点误导,因为答案只向我们展示了如何离线在RVM中安装ruby。我们需要能够离线安装RVM本身,并查看脚本https://raw.github.com/wayn
我有一个奇怪的问题:我在rvm上安装了rubyonrails。一切正常,我可以创建项目。但是在我输入“railsnew”时重新启动后,我有“程序'rails'当前未安装。”。SystemUbuntu12.04ruby-v"1.9.3p194"gemlistactionmailer(3.2.5)actionpack(3.2.5)activemodel(3.2.5)activerecord(3.2.5)activeresource(3.2.5)activesupport(3.2.5)arel(3.0.2)builder(3.0.0)bundler(1.1.4)coffee-rails(
我刚刚为fedora安装了emacs。我想用emacs编写ruby。为ruby提供代码提示、代码完成类型功能所需的工具、扩展是什么? 最佳答案 ruby-mode已经包含在Emacs23之后的版本中。不过,它也可以通过ELPA获得。您可能感兴趣的其他一些事情是集成RVM、feature-mode(Cucumber)、rspec-mode、ruby-electric、inf-ruby、rinari(用于Rails)等。这是我当前用于Ruby开发的Emacs配置:https://github.com/citizen428/emacs
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我的最终目标是安装当前版本的RubyonRails。我在OSXMountainLion上运行。到目前为止,这是我的过程:已安装的RVM$\curl-Lhttps://get.rvm.io|bash-sstable检查已知(我假设已批准)安装$rvmlistknown我看到当前的稳定版本可用[ruby-]2.0.0[-p247]输入命令安装$rvminstall2.0.0-p247注意:我也试过这些安装命令$rvminstallruby-2.0.0-p247$rvminstallruby=2.0.0-p247我很快就无处可去了。结果:$rvminstall2.0.0-p247Search
我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121
由于fast-stemmer的问题,我很难安装我想要的任何rubygem。我把我得到的错误放在下面。Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingfast-stemmer:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcreatingMakefilemake"DESTDIR="cleanmake"DESTDIR=
我是Google云的新手,我正在尝试对其进行首次部署。我的第一个部署是RubyonRails项目。我基本上是在关注thisguideinthegoogleclouddocumentation.唯一的区别是我使用的是我自己的项目,而不是他们提供的“helloworld”项目。这是我的app.yaml文件runtime:customvm:trueentrypoint:bundleexecrackup-p8080-Eproductionconfig.ruresources:cpu:0.5memory_gb:1.3disk_size_gb:10当我转到我的项目目录并运行gcloudprevie
当我尝试安装Ruby时遇到此错误。我试过查看this和this但无济于事➜~brewinstallrubyWarning:YouareusingOSX10.12.Wedonotprovidesupportforthispre-releaseversion.Youmayencounterbuildfailuresorotherbreakages.Pleasecreatepull-requestsinsteadoffilingissues.==>Installingdependenciesforruby:readline,libyaml,makedepend==>Installingrub