Well, I want to run a project on my Tencent [Cloud Server] (https://cloud.tencent.com/product/cvm?from=10680) recently. Since the server is a reinstalled system, I can only install tomcat manually.
However, tomcat is based on java, and tomcat can only be used in java environment, so the first thing to do is to install jdk.
First go to http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html to download a jdk to the local for subsequent use.
Then, after the download is complete, all we have to do is upload this file to the ubuntu server.
scp -r /home/jdk-8u161-linux-i586.tar.gz [email protected]:/svn
Enter the password and wait for uploading.
After the upload is complete, unzip the file to a suitable folder. Use the command:
tar zxvf /svn/jdk-8u161-linux-i586.tar.gz -C /home/java
Finally, configure the java environment variables
Edit the /etc/profile file and add the following content in the last line
export JAVA_HOME=/home/java/jdk1.8.0_161
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
Note that the path of JAV_HOME is the path where your java is located.
Then you can restart the machine to see if you can output relevant information by entering java.
If the output is successful, then your installation is successful. If there is no output, it is very likely that your jdk version is wrong. Note that 64-bit jdk must be installed for 64-bit and 32-bit jdk for 32-bit.
Generally, this problem occurs like this:
- bash: …… No such file or directory
Re-download and decompress, and the configuration is complete.
Use the same command to upload the file locally to the ubuntu server.
scp -r /home/apache-tomcat-9.0.6.tar.gz -C /home/tomcat
Then unzip, use the tar command:
sudo tar zxvf apache-tomcat-9.0.6.tar.gz -C /home/tomcat/
Finally, if this happens when entering the bin directory of tomcat
- bash: cd: bin: Permission denied
Then it is the problem of file permissions. For convenience, we directly open all permissions of this folder
sudo chmod 777-R apache-tomcat-9.0.6
If it does not appear, then it is the best.
Generally, here, we don't need to configure any tomcat.
Finally, in the bin directory, start tomcat
. /startup.sh
The shell output this text is a successful startup
Using CATALINA_BASE:/home/tomcat/apache-tomcat-9.0.6
Using CATALINA_HOME:/home/tomcat/apache-tomcat-9.0.6
Using CATALINA_TMPDIR:/home/tomcat/apache-tomcat-9.0.6/temp
Using JRE_HOME:/home/java/jdk1.8.0_161
Using CLASSPATH:/home/tomcat/apache-tomcat-9.0.6/bin/bootstrap.jar:/home/tomcat/apache-tomcat-9.0.6/bin/tomcat-juli.jar
Tomcat started.
After the configuration is completed, do you feel a sense of accomplishment? Do you want to know more professional knowledge, forward-looking information, and technical articles? Then please my personal official account: Attack program dog, make progress together!
Recommended Posts