Linux 下搭建jsp服务器(配置jsp开发环境)
Linux 做为服务器的高效一直时为人所熟知的了,在linux 上搭建各种各样的服务器和开发环境也时学计算机的人常做的。以下时最近在linux配置jsp服务器的全过程,包含一些基本步骤和排错过程:
1、安装java jdk
首先从官网下载jdk解压包,下载最新版的tar.gz 格式,下载完后进行解压缩:
Tar -zxvf *.tar.gz
将解压到的文件夹复制/usr/local 下(此处可以不做,只要记住jdk的路径即可,不过为了统一管理,建议还是将这一类的文件夹存放在一个固定的位置)
配置环境变量
//这种配置适用于登录系统的各个用户,会涉及到安全问题
Vim /etc/profile
在profile 文件的最后添加如下语句
export JAVA_HOME=/usr/local/{jdk 路径}
export JRE_HOME=/usr/local/{jdk 路径}/jre
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
重启!(或者编辑source /etc/profile 单次有效)
Javac java =version 确认
//这种设置适用于单个用户
Cd /home/{用户宿主目录}
vim .bashrc
在bashrc 文件的最后添加如下语句
export JAVA_HOME=/usr/local/{jdk 路径}
export JRE_HOME=/usr/local/{jdk 路径}/jre
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
2、安装myeclipse
从网上下载myeclise for linux的run 文件。
Chmod +x (附加权限)
Sudo sh myecliseforlinux.run
*这一步可能会遇到A Java RunTime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No java virtual machine was found after searching the following locations:…
这个问题,这个问题时在ubuntu安装的时候遇到的,原因是因为ubuntu自己提供了OPen java,这里需要激活我们安装的jdk。
解决方法:
在shell上输入以下命令
sudo update-alternatives --install "/usr/bin/java" "java" "jdk路径/bin/java" 300
sudo update-alternatives --install "/usr/bin/javac" "javac" "jdk路径/bin/javac" 300
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "jdk路径/bin/javaws" 300
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
接下来按照步骤一直往下安装。
有的朋友可能在安装的时候喜欢直接适用./myecliseforlinux 进行安装,这样子也是可以的,不过这样子很占内存,内存较小的机子容易死机。
3、安装tomcat
Tomcat的安装其实也只是一个解压的过程。将从官网下载下来的tar包解压到/etc/local下即可。通过目录下的bin/startup.sh 启动
配置myeclipse与tomcat整合的过程与在windows下配置的过程相同,在此就不再赘述了。
4、安装mysql
Mysql 的安装时整个安装过程中最困难的一步,不过mysql官网也提供了一套完整的文档,详情可以查询官网:mysql官方安装文档
具体步骤:
1、添加用户和用户组
groupadd mysql
useradd -r -g mysql mysql
2、解压从官网下载下来的tar包 移动到到/etc/local下
tar zxvf /home/user/mysql-5.5.15-linux2.6-i686.tar.gz
3、配置指向该文件的软链接
ln -s mysql-5.5.15-linux2.6-i686 mysql
4、更改文件的所属用户组
chown -R mysql .
chgrp -R mysql .
5、执行安装文件
cripts/mysql_install_db --user=mysql
6、再次配置文件所有者
chown -R root .
7、设置 data 目录的拥有者
# chown -R mysql data
8、复制配置文件
cp support-files/my-defult.cnf /etc/my.cnf
9、启动mysql
bin/mysqld_safe --user=mysql &
10、初始化密码
bin/mysqladmin -u root password 'new_password'
11、复制mysql.Server进init.d列表
cp support-files/mysql.server /etc/init.d/mysql.server
12、开机自动启动
sudo update-rc.d -f mysql.server defaults
本文是笔者在配置环境过后总结的安装方法和问题解决方法。其中参考了以下网站的资源,在此声明,并表示感谢
参考网站
mysql
http://blog.csdn.net/ichsonx/article/details/9285935
Myeclipse
http://www.linuxidc.com/Linux/2012-11/74190.htm

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The main reasons why you cannot log in to MySQL as root are permission problems, configuration file errors, password inconsistent, socket file problems, or firewall interception. The solution includes: check whether the bind-address parameter in the configuration file is configured correctly. Check whether the root user permissions have been modified or deleted and reset. Verify that the password is accurate, including case and special characters. Check socket file permission settings and paths. Check that the firewall blocks connections to the MySQL server.

C language conditional compilation is a mechanism for selectively compiling code blocks based on compile-time conditions. The introductory methods include: using #if and #else directives to select code blocks based on conditions. Commonly used conditional expressions include STDC, _WIN32 and linux. Practical case: Print different messages according to the operating system. Use different data types according to the number of digits of the system. Different header files are supported according to the compiler. Conditional compilation enhances the portability and flexibility of the code, making it adaptable to compiler, operating system, and CPU architecture changes.

1.0.1 Preface This project (including code and comments) was recorded during my self-taught Rust. There may be inaccurate or unclear statements, please apologize. If you benefit from it, it's even better. 1.0.2 Why is RustRust reliable and efficient? Rust can replace C and C, with similar performance but higher security, and does not require frequent recompilation to check for errors like C and C. The main advantages include: memory security (preventing null pointers from dereferences, dangling pointers, and data contention). Thread-safe (make sure multi-threaded code is safe before execution). Avoid undefined behavior (e.g., array out of bounds, uninitialized variables, or access to freed memory). Rust provides modern language features such as generics

The five basic components of Linux are: 1. The kernel, managing hardware resources; 2. The system library, providing functions and services; 3. Shell, the interface for users to interact with the system; 4. The file system, storing and organizing data; 5. Applications, using system resources to implement functions.

There are many reasons why MySQL startup fails, and it can be diagnosed by checking the error log. Common causes include port conflicts (check port occupancy and modify configuration), permission issues (check service running user permissions), configuration file errors (check parameter settings), data directory corruption (restore data or rebuild table space), InnoDB table space issues (check ibdata1 files), plug-in loading failure (check error log). When solving problems, you should analyze them based on the error log, find the root cause of the problem, and develop the habit of backing up data regularly to prevent and solve problems.

MySQL cannot run directly on Android, but it can be implemented indirectly by using the following methods: using the lightweight database SQLite, which is built on the Android system, does not require a separate server, and has a small resource usage, which is very suitable for mobile device applications. Remotely connect to the MySQL server and connect to the MySQL database on the remote server through the network for data reading and writing, but there are disadvantages such as strong network dependencies, security issues and server costs.

The solution to MySQL installation error is: 1. Carefully check the system environment to ensure that the MySQL dependency library requirements are met. Different operating systems and version requirements are different; 2. Carefully read the error message and take corresponding measures according to prompts (such as missing library files or insufficient permissions), such as installing dependencies or using sudo commands; 3. If necessary, try to install the source code and carefully check the compilation log, but this requires a certain amount of Linux knowledge and experience. The key to ultimately solving the problem is to carefully check the system environment and error information, and refer to the official documents.

The main reasons for MySQL installation failure are: 1. Permission issues, you need to run as an administrator or use the sudo command; 2. Dependencies are missing, and you need to install relevant development packages; 3. Port conflicts, you need to close the program that occupies port 3306 or modify the configuration file; 4. The installation package is corrupt, you need to download and verify the integrity; 5. The environment variable is incorrectly configured, and the environment variables must be correctly configured according to the operating system. Solve these problems and carefully check each step to successfully install MySQL.
