How to install CentOS, Jdk, and Tomcat

Source: Internet
Author: User

CentOS, Jdk, and Tomcat installation practices the first time they came into contact with the Liunx system, they all said that the J2EE system runs stably in the Linux environment, consumes less resources, and has fewer viruses. Basically, anti-virus software is not installed. Therefore, we will record and share the installation process. The first part of the Linux system has many Linux installation series, including Ubuntu, Redhat, and CentOS. Among them, Ubuntu is good at combining desktop and Windows operations and styles, redhat is a non-free version with copyright rights, while CentOS is a free version with release and RedHat. It is especially suitable for enterprise-level servers. Both 32bit and 64bit versions are available. This time, I chose the 32bit version of CentOS6.4 because it is installed on a common PC. Nonsense not much said, the following began to install: 1, first download iso installation files from the website, the official site: http://mirrors.neusoft.edu.cn/centos/6.4/isos/i386/CentOS-6.4-i386-LiveCD.iso 2, in order to be able to boot from the U disk, and install the system, first, you need to create a boot and installation USB flash drive. There are at least two methods. One is to create and install a boot disk in an existing Linux environment, the method for creating a Linux environment is obviously not feasible. I use another method: Download The UltraISO software from the Internet: http://www.onlinedown.net/soft/614.htm. Note that the USB flash drive should be larger than 8 GB. After the USB flash drive is created, you can delete all the packeage directories to save some space and Copy the iso files to the root directory of the USB flash drive. 3. Start the PC settings from the USB flash drive and insert the USB flash drive. Then you can see the CentOS installation and startup interface. Select the first option and Next. We recommend that you do not select SimpleChinese as the language, otherwise, there may be no window interface after installation, and only the Text interface can be installed twice. Instead, there is a graphic interface when the language environment is not selected at one time. The second part is that Jdk and Tomcat have just installed the CentOS system. Since there is no graphical interface, the first problem is how to share files from a USB flash drive or from other Windows and copy Jdk and Tomcat to the local device? 1. mount a USB flash drive. Use a USB flash drive to Copy the Jdk1.7.0 _ 15.rpm file from the Oracle website on Windows and Copy it to the USB flash drive. The format of the USB flash drive is Fat32, the Fat32 format is recognizable in both Windows and Linux. Note: Use the root user to log on to avoid permission issues. The Shell command is as follows: (1) create a folder, and then use mkdir/mnt/ntfs mkdir/usr/java (2) mount the USB flash disk and use fdisk-I to find the identifier of the USB flash disk in the system. When I run sda4 mount/dev/sda4/mnt/ntfs (3), I can copy files from the USB flash disk. first use the ls command to look at the file status of the USB flash disk ls-l (4) copy the file to the/usr/java directory cp/mnt/ntfs/jdk1.7.0 _ 15.rpm/usr/java (5) when installing jdk rpm-I/usr/java/jdk1.7.0 _ 15.rpm, several files not open will be prompted. (6) You need to use the Vi editor to set the environment, first, popularize the basic usage: After the vi file path/file name is entered, the editor is in command mode. Enter "I" to enter the editing mode (the "-INSERT-" text can be seen under the screen ), in edit mode, Press ESC to switch back to command mode. In command mode, enter ":" to enter the command. "W": Save the file; "q !": Exit; Add the following statement export JAVA_HOME =/usr/java/jdk1.7.0 _ 15 exportCLASS_PATH = To the end of vi/etc/profile in this file.: $ JAVA_HOME/lib/rt. jar: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar export PATH = $ PATH: $ JAVA_HOME/bin after saving and exiting, run the configuration file source/etc/profile and enter java-verison to check whether the information is successful, if we do not see the Jdk version we have installed, it is because CentOS itself comes with OpenJDK, so we need to update it. Follow these steps to enter the following command: first install java alternative --- jdk update-alternatives-install/usr/bin/java/usr/java/jdk1.7.0 _ 15/bin/java 60 and then configure JDK: after the update-alternatives-config java input is complete, a prompt is displayed, that is, the JDK installation package on your machine. Select the JDK 7 installation package. 2. to copy files from Windows shared folders, you must first configure the network and modify the network configuration of CentOS. (1) centOS modify IP address modify the corresponding Nic IP Address Configuration File # vi/etc/sysconfig/network-scripts/ifcfg-eth0 modify the following content DEVICE = eth0 # describe the NIC corresponding DEVICE alias, for example, in the ifcfg-eth0 file, it is eth0BOOTPROTO = static # Set the way the NIC gets the IP address, the possible option is static, dhcp or bootp, respectively corresponding to the static specified IP address, IP address obtained through dhcp protocol, IP address obtained through bootp protocol BROADCAST = 192.168.0.255 # corresponding subnet BROADCAST address HWADDR = 00: 07: E9: 05: E8: b4 # The physical IP address of the corresponding Nic IPADDR = 192.168.0.123 # If this parameter is set The IP address obtained by the network adapter is specified statically, this field specifies the IP address IPV6INIT = no00006_autoconf = noNETMASK = 255.255.255.0 # NETWORK mask NETWORK = 192.168.0.0 # NETWORK address of the NETWORK adapter ONBOOT = yes # whether to set the IP address when the system starts. this network interface, when set to yes, the device is activated when the system starts (2) centOS modify the gateway configuration file [root @ centos] # vi/etc/sysconfig/network modify the following NETWORKING = yes (indicates whether the system uses the network, it is generally set to yes. If it is set to no, the network cannot be used, and many system service programs cannot start) HOSTNAME = centos (set the Host Name of the local machine, the host name set here must correspond to the host name set in/etc/hosts. You can also use # To comment out GATEWAY = 192.168.1.1 (set the IP address of the GATEWAY connected to the local machine. For example, the gateway is 10.0.0.2) (3) CentOS modifies the DNS configuration file of the corresponding Nic # vi/etc/resolv. conf modify the following content: nameserver 192.168.0.1 (4) restart the network configuration # service network restart or #/etc/init. d/network restart mount the shared folder mount-t cifs-o username = "administrator ", password = "123456" // 192.168.0.100/Shared Folder/mnt/ntfs copy file. Just 3 seconds to decompress the tomcat.tag.gz file cd/usr/java and install Tomcat in this folder tar-zxvf/usr/java tomcat.tar.gz 4. Run Tomcat cd to the bin folder of Tomcat, run. /star Tup. sh. To disable tomcat, run the command. /shutdown. sh 5. Deployment file (1) copy the war file to the webapps folder of Tomcat using the network sharing established in step 1, and the system will automatically release the program. (2) test it. In a windows browser, enter http: // 192.168.0.123: 8080 to see if the cat is found. The result shows that the network connection is disconnected. Ping the address and find that the address can be pinged. It must be a firewall problem. (3) set the CentOS firewall and open port 8080/sbin/iptables-I INPUT-p tcp-dport 8080-j ACCEPT to save the firewall settings/etc/rc. d/init. d/iptables save restart firewall settings/etc/init. d/iptables restart input http: // 192.168.0.123: 8080 again, And Tomcat is published successfully.

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.