search
HomeDatabaseMysql TutorialLinux 下搭建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

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
When should you use a composite index versus multiple single-column indexes?When should you use a composite index versus multiple single-column indexes?Apr 11, 2025 am 12:06 AM

In database optimization, indexing strategies should be selected according to query requirements: 1. When the query involves multiple columns and the order of conditions is fixed, use composite indexes; 2. When the query involves multiple columns but the order of conditions is not fixed, use multiple single-column indexes. Composite indexes are suitable for optimizing multi-column queries, while single-column indexes are suitable for single-column queries.

How to identify and optimize slow queries in MySQL? (slow query log, performance_schema)How to identify and optimize slow queries in MySQL? (slow query log, performance_schema)Apr 10, 2025 am 09:36 AM

To optimize MySQL slow query, slowquerylog and performance_schema need to be used: 1. Enable slowquerylog and set thresholds to record slow query; 2. Use performance_schema to analyze query execution details, find out performance bottlenecks and optimize.

MySQL and SQL: Essential Skills for DevelopersMySQL and SQL: Essential Skills for DevelopersApr 10, 2025 am 09:30 AM

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

Describe MySQL asynchronous master-slave replication process.Describe MySQL asynchronous master-slave replication process.Apr 10, 2025 am 09:30 AM

MySQL asynchronous master-slave replication enables data synchronization through binlog, improving read performance and high availability. 1) The master server record changes to binlog; 2) The slave server reads binlog through I/O threads; 3) The server SQL thread applies binlog to synchronize data.

MySQL: Simple Concepts for Easy LearningMySQL: Simple Concepts for Easy LearningApr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL: A User-Friendly Introduction to DatabasesMySQL: A User-Friendly Introduction to DatabasesApr 10, 2025 am 09:27 AM

The installation and basic operations of MySQL include: 1. Download and install MySQL, set the root user password; 2. Use SQL commands to create databases and tables, such as CREATEDATABASE and CREATETABLE; 3. Execute CRUD operations, use INSERT, SELECT, UPDATE, DELETE commands; 4. Create indexes and stored procedures to optimize performance and implement complex logic. With these steps, you can build and manage MySQL databases from scratch.

How does the InnoDB Buffer Pool work and why is it crucial for performance?How does the InnoDB Buffer Pool work and why is it crucial for performance?Apr 09, 2025 am 12:12 AM

InnoDBBufferPool improves the performance of MySQL databases by loading data and index pages into memory. 1) The data page is loaded into the BufferPool to reduce disk I/O. 2) Dirty pages are marked and refreshed to disk regularly. 3) LRU algorithm management data page elimination. 4) The read-out mechanism loads the possible data pages in advance.

MySQL: The Ease of Data Management for BeginnersMySQL: The Ease of Data Management for BeginnersApr 09, 2025 am 12:07 AM

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor