Linux下安装Web开发的所有环境
Create group and user
groupadd mysql
useradd -g mysql mysql
Install JDK
tar xvf jdk-7u25-linux-x64.gz
cp -r jdk1.7.0_25/ /usr/local
vi /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/jdk1.7.0_25/bin" --- Add ":/usr/local/jdk1.7.0_25/bin" to the PATH, and add the following to environment, when done, use wq to exit and save
CLASSPATH=.:/usr/local/jdk1.7.0_25/lib
JAVA_HOME=/usr/local/jdk1.7.0_25
JRE_HOME=/usr/local/jdk1.7.0_25/jre
update-alternatives --install /usr/bin/java java /usr/local/jdk1.7.0_25/bin/java 300
update-alternatives --install /usr/bin/javac javac /usr/local/jdk1.7.0_25/bin/javac 300
update-alternatives --config java
source /etc/environment
Install Tomcat
tar xvf apache-tomcat-7.0.26.tar.gz
cp -r apache-tomcat-7.0.26 /usr/local
cd /usr/local
./apache-tomcat-7.0.26/bin/startup.sh
tail -f -n 200 apache-tomcat-7.0.26/logs/catalina.out
Install Ant
unzip apache-ant-1.9.1
cp -r apache-ant-1.9.1 /usr/lib
vi /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/apache-ant-1.9.1/bin" --- Add ":/usr/lib/apache-ant-1.9.1/bin" to the PATH, when done, use wq to exit and save
source /etc/environment
ant -version
You will see:Apache Ant(TM) version 1.9.1 compiled on May 15 2013
Install Apr
tar xvf apr-1.4.8.tar.gz
cd apr-1.4.8/
./configure --prefix=/usr/local/apr
apt-get install make
make
make install
Install Apr-util
tar xvf apr-util-1.5.2.tar.gz
cd apr-util-1.5.2/
./configure --prefix=/usr/local/apr -with-apr=/usr/local/apr
make
make install
Install Tomcat-native-lib
cd /usr/local/apache-tomcat-7.0.26/bin
tar zxvf tomcat-native.tar.gz
cd tomcat-native-1.1.22-src/jni/native
./configure --with-apr=/usr/local/apr -with-java-home=/usr/local/jdk1.7.0_25
make
make install
The tomcat use apr
cd bin
vi catalina.sh
CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib" --- Add "CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib", when done, use wq to exit and save
Install Mysql
tar xvf mysql-5.5.32-linux2.6-x86_64.tar.gz
cp -r mysql-5.5.32-linux2.6-x86_64 /usr/local/mysql-5.5.32
cd /usr/local/mysql-5.5.32
chown -R root ./
chgrp -R mysql ./
chown -R mysql data
cp support-files/mysql.server /etc/init.d/mysql.server
cp support-files/my-medium.cnf /etc/my.cnf
./scripts/mysql_install_db --user=mysql&
./bin/mysqld_safe &
bin/mysqladmin -u root password 'password'
bin/mysql -uroot -p
Install Nginx
apt-get install -y libpcre3 libpcre3-dev zlib1g-dev
tar -zxvf nginx-1.4.2.tar.gz
cd nginx-1.4.2/
./configure --prefix=/usr/local/nginx
make
make install
/etc/init.d/nginx
ps -e | grep ngin
6852 ? 00:00:00 nginx
6853 ? 00:00:00 nginx
Install Sqlite
tar xvf sqlite-autoconf-3071700.tar.gz
cd sqlite-autoconf-3071700/
./configure --prefix=/usr/lib/sqlite
make
make install
Install Svn
tar xvf subversion-1.8.0.tar.gz
cp -r subversion-1.8.0 /usr/lib
cd /usr/lib/subversion-1.8.0
./configure --with-apr=/usr/local/apr -with-apr-util=/usr/local/apr -with-sqlite=/usr/lib/sqlite
make
make install
Install OpenSSL
tar -zxvf openssl-1.0.1e.tar.gz
cd openssl-1.0.1e/
./config --prifix=/usr/local/openssl --openssldir=/usr/local/openssl
make
make install
openssl version -a
Startup and verify FAQ
Startup Mysql
cd /usr/local/mysql-5.5.32
./bin/mysqld_safe
bin/mysql -uroot -p --- enter password 'password', if you see 'Welcome to the MySQL monitor. Commands end with ; or \g.......', it start normally
Startup Tomcat
cd /usr/local/apache-tomcat-7.0.26/bin
./startup.sh
ps -ef |grep tomcat --- if you see 'org.apache.catalina.startup.Bootstrap start', it start normally(or you open your browser, 192.168.225.138:8080, if see the tomcat welcome page, it startup normally)
Startup Nginx
/etc/init.d/nginx
ps -e | grep nginx --- if you see '6852 ? 00:00:00 nginx 6853 ? 00:00:00 nginx', it start normally(or you open your browser, 192.168.225.138, if see the nginx welcome page, it startup normally)
Close Mysql
kill 9482 --- 9482 is the process id of mysql
ps -ef |grep mysql --- if you see nothing, it stop normally
Close Tomcat
cd /usr/local/apache-tomcat-7.0.26/bin
./shutdown.sh --- if you only see 'user 11401 10844 0 18:25 pts/0 00:00:00 grep --color=auto tomcat', it stop normally(or you open your browser, 192.168.225.138:8080, cannot see tomcat welcome page)
Close Nginx
kill 9124 --- 9124 is the process id of nginx --- if you see nothing, it stop normally(oryou open your browser, 192.168.225.138, cannot see nginx welcome page)