Deployment records of Alibaba Cloud Debian Linux

Source: Internet
Author: User

Abstract:

Mainly installed in the web environment, Java + Tomcat + MySQL + nginx (no use at the moment)

Data disks are mounted under/data, projects, and indexes are stored under the/data directory.

Java, tomcat, and MySQL programs are all created in/root/WWW with shortcuts

 

1. install the software package

All software downloaded by APT-Get install is stored in the/var/Cache/APT/archives directory. You can use apt-Get autoclean or apt-Get clean to delete downloaded packages.

2. Install MySQL 5.6.deb

Dpkg-I mysql-5.6.15-debian6.0-x86_64.deb

MySQL 5.6 is initialized at/opt/MySQL/Server-5.6.

Create a user and group named MySql in the system, and specify the MySQL user's home directory/usr/local/MySQL/Data

Find a MySQL software
Then, because MySQL is manually installed, you need to create a user and group named MySql in the system, and set the musql user's home directory to "/usr/local/MySQL/data"
# Groupadd-G 200 MySQL
# Useradd-u 200-G mysql-D/usr/local/MySQL/data-M MySQL
Then release the software package to the "/usr/local/" directory. To facilitate management, run the ln command to create the symbolic link directory of this directory as MySQL.
# Tar zxvf MySQL-server-5.1.53-1.glibc23.i386.tar.gz-C/usr/local/
# Cd/usr/local/
# Ln-s MySQL-server-5.1.53-1.glibc23.i386/MySQL
Create a sub-directory named MySql in "var/lib" and set the owner and group of the Directory and the installation directory of the MySQL server.
# Mkdir/var/lib/MySQL
# Chown-r MYSQL: MySQL/var/lib/MySQL
# Chown-r root: MySQL/usr/local/MySQL-server-5.1.53 *
# Chown-r MYSQL: MySQL/usr/local/MySQL/data/
Go to the MySQL server program directory, copy the MySQL configuration file my. CNF to the "/etc" directory, and run the mysql. install_db command to initialize the database on the MySQL server.
# Cd/usr/local/MySQL
# Cp support-files/my-medium.cnf/etc/My. CNF
If the MySQL RPM package has been installed in the system, the "/etc" directory will contain the my. CNF file, and the system will prompt to overwrite the original my. CNF file.
CP: overweite '/etc/My. CNF '? Y
#./Scripts/My
1. Download the MySQL 5.5 Deb installation package

CD/usr/local/src

Sudo wget-O mysql-5.5.22-debian6.0-i686.deb http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.22-debian6.0-i686.deb/from/http://mysql.ntu.edu.tw/

2. Install the Deb package

Sudo dpkg-I mysql-5.5.22-debian6.0-i686.deb

The MySQL server is initialized at/opt/MySQL/Server-5.5.

3. Enabling MySQL

Groupadd MySQL

Useradd-r-g MySQL

Sudo apt-Get install libaio-Dev

Ln-S/opt/MySQL/Server-5.5/usr/local/MySQL

Sudo mkdir/usr/local/MySQL/Data

Sudo chown-r mysql./usr/local/MySQL/Data

Initialize Database

Sudo/usr/local/MySQL/scripts/mysql_install_db -- user = MySQL -- basedir =/usr/local/MySQL -- datadir =/usr/local/MySQL/Data

Put the startup shell program of mysqld in the system service directory.

Sudo CP/usr/local/MySQL/support-files/MySQL. Server/etc/init. d/MySQL

Put the MySQL configuration file in the/etc directory of the System Configuration. MySQL should use this configuration file in the global scope.

Sudo CP/usr/local/MySQL/support-files/my-medium.cnf/etc/My. CNF

Start MySQL

Sudo/etc/init. d/MySQL start

Change the MySQL root administrator password

Sudo/usr/local/MySQL/bin/mysqladmin-u Root Password [the password you want to set]

Test whether you can log on to MySQL

Sudo/usr/local/MySQL/bin/MySQL-u root-P [Optional database name]

MySQL. Sock is stored in/tmp/MySQL. Sock

Note: If you add mysql_server to the system service directory/etc/init. d/must ensure that the MySQL program directory is in/usr/local/MySQL. You can use soft links to direct to other installation directories.

If mysql-common is installed later, the configuration file of MySQL server will be affected. You need to change the/etc/MySQL/My. basedir, datadir, and log in CNF or modify PHP. settings in ini, such as PDO

Set Environment Variables

2. Modify the profile file:
# Vi/etc/profile
Add:
Export Path = "$ path:/opt/au1200_rm/build_tools/bin"
3. Modify the. bashrc file:
# Vi/root/. bashrc
Add:
Export Path = "$ path:/opt/au1200_rm/build_tools/bin"
The last two methods generally take effect after you log out of the system again. Finally, you can test them using the echo command:
# Echo $ path
Check whether the path/my_new_path already exists in the output.

 

 

========================================================== ======================================

Install JDK

Install and configure JDK 7 in Linux (Debian 7) 1. Download JDK

The latest JDK version is Java SE Development Kit 7u5.

: Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

View latest: http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Unzip and install

Install JDK to this path:/usr/lib/JVM
If this directory does not exist (of course not exist for the first time), we will create a new directory.

cd /usr/libsudo mkdir jvm

After the creation, we will go to the directory of the downloaded compressed package, decompress it to the folder we just created, and modify the name to facilitate our management.

sudo tar zxvf ./jdk-7-linux-i586.tar.gz  -C /usr/lib/jvmcd /usr/lib/jvmsudo mv jdk1.7.0_05/ jdk7
3. Configure Environment Variables
gedit ~/.bashrc

Add

export JAVA_HOME=/usr/lib/jvm/jdk7export JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATH

Save and exit, and then enter the following command to make it take effect

source ~/.bashrc
4. Configure the default JDK

The default JDK exists in some Linux distributions, such as openjdk. So in order to make the installed JDK version become the default JDK version, we need to make the following configuration.
Run the following command:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk7/bin/java 300 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk7/bin/javac 300

Note: If the above two commands fail to find the path, restart the computer and repeat the above two lines of code.

Run the following code to view the current JDK versions and configurations:

sudo update-alternatives --config java
5. Test

Open a terminal and enter the following command:

java -version

Display result:

java version "1.7.0_05" Java(TM) SE Runtime Environment (build 1.7.0_05-b05)Java HotSpot(TM) Server VM (build 23.1-b03, mixed mode)

This indicates that the Java command can be run.

 

========================================================== ========================================================== ===

Install Tomcat

Use Apache to install APR and APR-util

(1) install Apr. This is a set of localized sockets, threads, and I/O components developed by Apache to improve Tomcat performance. That is to say, Apache has advanced I/O functions and calls functions at the operating system level, and local process processing.
(2) install Tomcat native. This project allows tomcat to use Apache's APR package to handle file and network I/O operations to improve performance.
1. Install APR
(1) install APR
# Wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
# Tar zxvf apr-1.4.5.tar.gz
# Cd apr-1.4.5
#./Configure -- prefix =/usr/local/www/APR
# Make
# Make install
(2) install Apr-iconv
# Wget http://archive.apache.org/dist/apr/apr-iconv-1.2.1.tar.gz
# Tar-zxvf apr-iconv-1.2.1.tar.gz
# Cd apr-iconv-1.2.1
#./Configure -- prefix =/usr/local/www/APR-iconv -- With-Apr =/usr/local/www/APR
# Make
# Make install
(3) install Apr-util
# Wget http://archive.apache.org/dist/apr/apr-util-1.3.10.tar.gz
# Tar zxvf apr-util-1.3.10.tar.gz
# Cd apr-util-1.3.10
#. /Configure -- prefix =/usr/local/www/APR-util -- With-Apr =/usr/local/www/APR -- With-Apr-iconv =/usr/local/ WWW/APR-iconv/bin/paiconv
# Make
# Make install
2. install Tomcat and tomcat-native
(1) JDK Installation
# Wget http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-x64-rpm.bin
# Chmod A + x jdk-7u25-linux-x64-rpm.bin
#./Jdk-6u25-linux-x64-rpm.bin
# Ln-S/usr/Java/jdk1.7/usr/local/Java
Set Environment Variables
# Vi/etc/profile
Add the following content at the end
Set java_home =/usr/local/Java
Export java_home
Set Path = $ java_home/bin: $ path
Export path
Set classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export classpath
# Java-version
Check the Java version. If it is 1.7, the installation is successful.
(2) install Tomcat
# Wget http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.tar.gz
# Tar-zxvf apache-tomcat-7.0.14.tar.gz
# Mv APACHE-Tomcat-7.0.14/usr/local/www/tomcat
# Vi/usr/local/www/tomcat/bin/Catalina. Sh
Add a row:
Java_home =/usr/local/Java
#/Usr/local/www/tomcat/bin/startup. Sh
(3) install Tomcat-native

After Tomcat 7 is installed, Tomcat-native is already in the bin directory of Tomcat and can be directly used.
# Cd/usr/local/www/tomcat/bin
# Tar zxvf tomcat-native.tar.gz
# Cd tomcat-native-1.1.20-src/JNI/native
#./Configure -- With-Apr =/usr/local/www/APR -- With-Java-home =/usr/local/Java
# Make
# Make install
(4) set APR environment variables:
# Vi/etc/profile
Add the following content
Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/APR/lib
# Source/etc/profile
# Bin/startup. Sh start Tomcat

The console content will be written in logs/Catalina. Out. If you only want to view the content, use more logs/Catalina. Out. The efficiency is higher than that of vi. you can press the Space key to flip the page.

You can use

# Tail-F logs/Catalina. Out

Terminate by Crul + c

========================================================== ==========================================================

 

Install nginx

/OPT directory

 

======================================

Run the DF command to view the disk space.

DF-H

 

View the occupied size of a folder: Du-SH /*

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.