Linux install software on the system:
. 1, RPM install software package (JDK installation)
2, yum method of installing software (mysql installation)
3, software installation source (Tomcat installation)
////////// ////////////////////////////////////////////////// ////
jdk installation:
go online to download jdk file:
jdk-7u79-Linux-x64.rpm
then sent to Xftp 4 at home with Linux file systems
under Linux in the home file, type ls to view directories
if jdk -7u79-linux-x64.rpm file,
enter: rpm -ivh jdk-7u79-linux -x64.rpm the transport, installation
, after the installation is complete, enter:
the Java -version enter
if there appears the following: java version "1.7. 0_79 "
input ll View:
you'll see:
. -rw-r - r-- 1 root root 138 082 565 Jun 23 13:45 the JDK-7u79-Linux-x64.rpm
create and write a java code to test: (home directory)
HelloWorld.java vim
public class the HelloWorld {
// project name to keep the same file name, namely: the HelloWorld
public static void main (String [] args) {
System.out.println ( "! the Hello Linux");
}
}
compile the tests java code:
javac HelloWorld.java
run java code:
java the HelloWorld
If it is successful, the jdk installation was successful.
////////////////////////////////////////////////// ///////
Tomcat installation:
go online to download the file Tomcat:
the Apache-Tomcat-7.0.73.tar.gz
then sent to the next home Linux file system with Xftp 4
at home in the Linux file, type ls View directory
if apache-tomcat-7.0.73.tar.gz, the transmission was successful.
In the Linux home directory, enter:
tar -zxvf the Apache-tomcat-7.0.73.tar.gz unzip tomcat
input under Linux home directory:
cd the Apache-tomcat-7.0.73 Enter
cd bin Enter
ls Enter
project the next will be: tomcat-juli.jar
running tomcat: (bin directory)
./startup.sh
view firewall status, enter: (bin directory)
Service status iptables
turn off the firewall, enter: (bin directory)
Service iptables STOP
access ip address of the virtual machine :( access Tomcat)
http://192.168.128.128:8080/ as a successful visit, the installed Tomcat
////////////////////// ///////////////////////////////////////////////
MySQL installation
modify yum source:
Download wget :( enter the following command in your home files, it seems you can download the following commands in any file)
yum -y install wget
after the backup completes execution :( above, enter the following command)
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
download new the CentOS-Base.repo to /etc/yum.repos.d/
(select the following CentOS 6, 6 and the path of the command with a command input)
the CentOS. 5:
wget -O /etc/yum.repos.d/CentOS http://mirrors.aliyun.com/repo/Centos-5.repo -Base.repo
CentOS 6:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com /repo/Centos-6.repo
CentOS 7:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
run later, enter the following command:
yum makecache (creation buffer) (yum source installed)
in the command window, enter the command:
yum -y install mysql-server (download and install mysql)
to set the boot, enter the following command:
chkconfig mysqld ON
chkconfig --list mysqld
start mysql service, enter the following command:
Service mysqld Start
View services have started to view the mysql process , enter the following command:
-Service mysqld Status
is set to root mysql user password:
mysql -u root
view user password:
mysql> SELECT user, Host, password from the mysql.user;
following command to set the root password is root
mysql> sET password for root @ localhost = password ( 'root');
exit:
mysql> exit;
login mysql database root user password:
mysql-uroot--proot;
view the system already exists in the database:
mysql> show databases;
create a database named testmysql01:
MySQL> the Create Database testmysql01;
using the selected database:
use testmysql01;
delete selected database:
drop Database testmysql01;
add data to the user in the form mydata database:
First check system existing databases:
MySQL> Show databases;
secondly you need to add database form data resides:
MySQL> use mydata;
see the form databases:
MySQL> Show the Tables;
add data:
MySQL> INSERT INTO the User (name, pwd) values ( 'Shankoubaihui', 20);
other basic CRUD, sql statement can use standard.
Exit Database Connection:
MySQL> Exit;
CREATE TABLE `user` (` id` int (11) NOT NULL AUTO_INCREMENT, `name` varchar (32) DEFAULT NULL,` pwd` varchar (32) DEFAULT NULL, PRIMARY KEY ( `id`)) ENGINE = InnoDB AUTO_INCREMENT = the DEFAULT the CHARSET = UTF8. 17;
//////////////////////////////////////////// //////////////////
open firewall ports:
enter the following command, open the firewall file:
vim / etc / sysconfig / iptables
find the following commands to copy, paste and 2 command line:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
copy command is modified:
-A State --state the INPUT NEW -m -m -p TCP TCP --dport 8080 ACCEPT -j
-A -m State --state the INPUT -p tcp -m tcp NEW --dport 3306 -j ACCEPT
save and exit the command:
: WQ
turn off the firewall and the firewall command:
turn on the firewall:
service iptables start
off the firewall:
Service iptables STOP
boot does not start Firewall:
chkconfig iptables OFF
View firewall status:
Service iptables Status
About Firewall:
effective immediately, restart failed
open: service iptables start
shut down: service iptables stop
to take effect after reboot
open: chkconfig iptables on
close: chkconfig iptables OFF
//////////////////////////////////////////// ////////////////////////
Linux mysql database connection:
Linux side:
Log mysql:
mysql-uroot--proot
develop remote login permissions:
. mysql> GRANT ALL PRIVILEGES ON * * TO 'root' @ '%' IDENTIFIED BY 'root' WITH GRANT OPTION;
Refresh:
MySQL> the FLUSH PRIVILEGES;
MySQL end:
File:
New Connection
connection name:
input Linux ip address (e.g. : 192.168.128.128)
host name:
general Linux also enter the ip address
to enter a password, connection test, after the connection is successful, press the enter key to create a connection.
Click on the link in the database, if you can open the database, the connection is successful.
////////////////////////////////////////////////// /////////////////
solve the garbage problem: (mysql encoding settings under Linux)
first looks cnf file location mysql, the command:
the Find / -iname '* .cnf' -print;
then, copy-small.cnf My, My-medium.cnf, huge.cnf-My,
My-InnoDB-Heavy-4G.cnf /etc/my.cnf one to the next, the command:
/usr/share/mysql/my-medium.cnf /etc/my.cnf cp
cp: overwrite "/etc/my.cnf"? y
modify the my.cnf (command):
VI /etc/my.cnf
. 1, the [client] was added under: default-character-set = utf8 , such as:
# of The following Options Will BE All passed to the MySQL Clients
[client]
# = your_password password
Port = 3306
Socket = /var/lib/mysql/mysql.sock
(insert here) default = UTF8-Character-SET
# here Follows entries It for some specific Programs
2, was added in [mysqld] field: character- Server-UTF8 = SET
# of The the MySQL Server
[mysqld]
(Inserted here) Character-SET = UTF8-Server
Port = 3306
Socket = /var/lib/mysql/mysql.sock
. 3, the [MySQL] join fields which: default-Character-SET = UTF8
[MySQL]
NO-Auto -rehash
(insert here) default-Character-the SET utf8 =
# the Remove the Comment the Next Character at The IF you are not Familiar is with SQL
# Safe-the Updates
save and quit:
: WQ
restart mysql command:
Service mysqld restart
Log mysql command:
mysql - uroot -proot
See codeset:
MySQL> Show Variables like 'Character%';
The following information is encoded Review complete set:
+ --------- + ------------ + ----------------
| variable_name | Value |
+ -------------------------- + + ----------------------------
| character_set_client | utf8 |
| the character_set_connection | utf8 |
| the character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| Character_set_system | utf8 |
| character_sets_dir | / usr / report this content share / MySQL / charsets / |
+ -------------------------- + ---- + ------------------------
8 rows in the SET (0.00 sec)
///////////////// ////////////////////////////////////////////////// ///
to deploy the project to the Linux system :( premise: the jdk, tomcat, mysql are installed)
installed http services on Linux, the command:
yum -y install httpd
start http service, order: (home directory)
service httpd start
setting boot command:
chkconfig httpd ON
View open state to start, the command:
chkconfig --list httpd
turn off the firewall, the command: (home directory) (if equipped with a firewall port 8080, can not be turned off)
service iptables stop
set the boot does not start firewall command:
chkconfig iptables OFF
test:
Open the ip address of the page, enter the virtual machine server,
you can jump to the Apache 2 Test Page page, then prove http service installed.
Open eclipse myeclipse or
find the items you need to deploy a
test:
whether the normal access success.
After a successful visit:
find projects ip address of the database connection,
the connection to the database ip address changed to: localhost or Linux ip address.
The database name to Linux in the corresponding database name,
and then transferred to the Linux form the corresponding database.
The project is tied to the war package:
Right-click on the project:
Select the Export option to
select WAR file inside, and then next
Or inside Select an export destination input: war
select WAR file, and then next
and then select the output to the desktop
using Xftp software tools:
the output to the desktop just .war file transfer to Linux in the webapps directory of tomcat.
(Directory path: /home/apache-tomcat-7.0.73/webapps)
go to the bin directory under tomcat in Linux:
(directory path: /home/apache-tomcat-7.0.73/bin)
command: cd / -> cd home -> cd apache -tomcat-7.0.73 -> cd bin
to bin directory under the file executable permissions assigned, :( command in the bin directory)
chmod + U * the X-
start tomcat in the project command:
./startup.sh
access project:
to ip address before a successful test project URL into Linux ip address access
if access is successful, the successful deployment of the project.
///////////////////////////////////////////////////////////////////