Linux Jdk+tomcat+mysql+redis Installation Log

Source: Internet
Author: User
Tags mysql version openssl

Check if Iptables is installed

#先检查是否安装了iptables
Service Iptables Status
#安装iptables
Yum install-y iptables
#升级iptables
Yum Update iptables
#安装iptables-services
Yum Install Iptables-services
Disable/stop your own FIREWALLD service

#停止firewalld服务
Systemctl Stop Firewalld
#禁用firewalld服务
Systemctl Mask Firewalld
Set up an existing rule

#查看iptables现有规则
iptables-l-N
#先允许所有, or it might be a cup.
iptables-p INPUT ACCEPT
#清空所有默认规则
iptables-f
#清空所有自定义规则
Iptables-x
#所有计数器归0
iptables-z
#允许来自于lo接口的数据包 (Local access)
iptables-a input-i lo-j ACCEPT
#开放22端口
iptables-a input-p tcp--dport 22-j ACCEPT
#开放21端口 (FTP)
iptables-a input-p tcp--dport 21-j ACCEPT
#开放80端口 (HTTP)
iptables-a input-p tcp--dport 80-j ACCEPT
#开放8080端口
iptables-a input-p tcp--dport 8080-j ACCEPT
#开放443端口 (HTTPS)
iptables-a input-p tcp--dport 443-j ACCEPT
#允许ping
iptables-a input-p ICMP--icmp-type 8-j ACCEPT
#允许接受本机请求之后的返回数据 related, which is set for FTP
iptables-a input-m State--state related,established-j ACCEPT
#其他入站一律丢弃
iptables-p INPUT DROP
#所有出站一律绿灯
iptables-p OUTPUT ACCEPT
#所有转发一律丢弃
iptables-p FORWARD DROP
Save Rule Settings

#保存上述规则
service iptables save
start iptables Service

#注册iptables服务
#相当于以前的chkconfig iptables on
Systemctl Enable Iptables.service
#开启服务
Systemctl Start Iptables.service
#查看状态
Systemctl Status Iptables.service
With this centOS7 firewall configuration is complete

Installing the Java Environment

Download jdk:jdk-7u79-linux-x64.tar.gz
Place jdk-7u79-linux-x64.tar.gz in/usr/local/to extract it into a Java folder

Cd/home
Mkdir/usr/local/java
TAR-XZVF./jdk-7u79-linux-x64.tar.gz #解压后得文件夹jdk1.7.0_79
sudo mv./jdk1.7.0_79/*/usr/local/java
Cd/etc Edit Profile VI Profiles
Enter I into edit mode and place the following configuration at the end of the file

Export Java_home=/usr/local/java
Export JRE_HOME=/USR/LOCAL/JAVA/JRE
Export path= $PATH:/usr/local/java/bin
Export Classpath=./:/usr/local/java/lib:/usr/local/java/jre/lib
Input source/etc/profile make configuration effective
Verify that the Java environment java-version The version number indicates that the validation was successful and vice versa

Install the MySQL environment (see CentOS installation MySQL)

Installing dependent libraries

Yum install-y gcc gcc-c++ kernel-devel NTP vim-enhanced Flex Bison autoconf make Automake bzip2-devel ncurses-devel zlib- Devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libxpm-devel gettext-devel pam-devel libtool Libtool-ltdl OpenSSL openssl-devel fontconfig-devel libxml2-devel curl-devel libicu libicu-devel libmcrypt libmcrypt-devel Libmhash Libmhash-devel pcre-devel libtool-libs gd file patch mlocate diffutils readline-devel glibc-devel glib2-devel Libcap-devel

Yum Install-y Libaio
Move to the installation directory

sudo mkdir/usr/local/mysql
Cd/home
TAR-XZVF./mysql-5.5.49-linux2.6-x86_64.tar.gz
sudo mv./mysql-5.5.49-linux2.6-x86_64/*/usr/local/mysql
New user

sudo groupadd MySQL
sudo useradd-g mysql-s/usr/sbin/nologin MySQL #不让mysql用户直接登录
sudo chown-r mysql:mysql/usr/local/mysql/
Copying a configuration file

Cp/usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf
Set permissions

chmod +x/usr/local/mysql
Chown-r Mysql:mysql/usr/local/mysql
Configure boot auto-start

cp/usr/local/mysql/support-files/ Mysql.server/etc/init.d/mysqld
chmod + X/etc/init.d/mysqld
chkconfig--add Mysqld
chkconfig--list mysqld #查看是否已应用上
add a soft link to MySQL to fit the init script

Ln-sv/usr/local/mysql/bin/mysql/usr/sbin/mysql
Ln-sv/usr/local/mysql/bin/mysqladmin/usr/sbin/mysqladmin
Ln-sv/usr/local/mysql/bin/mysqldump/usr/sbin/mysqldump
Modifying a configuration file

Vim/etc/my.cnf
Enter edit mode (input i) to add in [Mysqld] node

DataDir =/usr/local/mysql/data
Log-error =/usr/local/mysql/data/error.log
Pid-file =/usr/local/mysql/data/mysql.pid
user = MySQL
Tmpdir =/tmp
Save exit (Press Esc key to enter: Wq carriage return)
Initializing the database

sudo/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user= Mysql
Configure the firewall to turn on port 3306

Vim/etc/sysconfig/iptables
Add the following rule to port 22 below the rule.

-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
Restarting the firewall

/etc/init.d/iptables Restart # or service iptables restart
Start MySQL

Service mysqld Start # or/etc/init.d/mysqld start
See if there is a MySQL process

Ps-ef | grep MySQL
See if there is a MySQL port

NETSTAT-NTLP | grep 3306
Change the root password (because the password was not previously set, so you can enter it directly when you require a password)

/usr/local/mysql/bin/mysqladmin-u root-p password ' 123456 '
To test whether the Mysql,mysqladmin,mysqldump command is working properly
Read the MySQL version information

Mysqladmin-u root-p Version
To this MySQL compilation installation is complete.

Installing Tomcat

Place the installation package apache-tomcat-8.0.35.tar.gz under/usr/local/
Execute command

Tar-zxv-f apache-tomcat-7.0.29.tar.gz//Decompression Package
RM-RF apache-tomcat-7.0.29.tar.gz//Delete a compressed package
CD bin///Enter the Bin folder
./startup.sh//Start Tomcat
Attached: Configuring the HTTPS protocol (refer to TOMCAT8 support HTTPS protocol)

Use the tools provided by the JDK to complete the certificate generation
Certificate Generation page
PS: The secret key file name is optional

2. Modify Tomcat's Server.xml file configuration information to support the HTTPS protocol. The file location under Tomcat conf, comment out the original connection information, the following annotated HTTPS protocol connection configuration information is enabled, and the new certificate file location and password
Tomcat configuration file Modification

3. Start Tomcat, as we directly configure the HTTPS default port so enter Https://localhost access in the address bar
The following page appears to indicate success
Configuration succeeded

Installing Redis (refer to CentOS7 installation configuration redis-3.0.0)

Place the installation package redis-3.2.4.tar.gz in the/usr/local/directory
Execute the following command

#解压压缩包
tar-zxv-f redis-3.2.4.tar.gz
#删除压缩包
RM-RF redis-3.2.4.tar.gz
#进入目录
CD redis-3.2.4
#编译
Make
#启动redis
Src/redis-server &
#测试redis
src/redis-cli
when 127.0.0.1:6379> appears, the installation is successful.

Linux Jdk+tomcat+mysql+redis Installation Log

Related Article

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.