Linux configure for java web developer

2024-06-06 20:18

本文主要是介绍Linux configure for java web developer,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

安装ubuntu需要配置文件和安装许多软件,因为自己对ubuntu没有深入的了解,出了一些问题就会重装系统。多装几次后总结了一些常用的配置和踩过的坑:

分区方案

/boot     boot分区,引导系统程序所需要的文件,安装多个操作系统时用来引导
/         根分区
/usr      系统用户工具和程序
/home     用户目录
swap分区   大小约等于内存的大小,相当于win下的虚拟内存

更改root权限密码

刚安装好的ubuntu root权限密码需要激活

sudo passwd

更新软件源

设置–>软件和更新–>更改服务器,取消掉下载源码选项会节省很多时间。

 sudo apt-get updatesudo apt-get upgrade

删除不必要的软件

亚马逊等封装在ubuntu的软件对我们没用,在软件中新删除

安装搜狗拼音

检查是否安装fcitxbssh

sudo apt-get install fcitx libssh
dpkg -l|grep fcitx
dpkg -l|grep libssh

去搜狗输入法官网下载安装,重启之后生效

配置java

  • 下载jdk
  • 配置环境变量
sudo vim /etc/profile
add
export JAVA_HOME=your jdk dir
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
EXITsource /etc/profile
  • /etc/environment与/etc/profile的区别
    /etc/environment针对的时整个系统的设置,而/etc/profile针对/home目录下的用户
    如果以上两个文件的配置相同,会在用户的桌面环境中显示/etc/profile中的配置

安装GIT

git官网
git帮助

$ git help <verb>
$ git <verb> --help
$ man git-<verb>e.g.
git help config

注意:使用代理或者无法连网的情况下git push -u origin master会报错:

ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.Please make sure you have the correct access rights
and the repository exists.

我们可以停用代理或者修改ssh代替https
SSH / Using SSH over the HTTPS port

SSH / Error: Bad file number

ssh

ssh与git和github相关的配置
公钥和私钥

ssh-keygen -t rsa -C "your email"
cd ~/.ssh
将id_rsa.pub中的内容复制到github中
测试
ssh -T git@github.com

install mysql

ubuntu自带的包版本和社区维护的版本有区别,一般官方社区维护的版本要比ubuntu团队的版本更新快,所以我们安装社区的版本

  1. 下载.deb文件,注意选择版本
  2. Adding the MySQL APT Repository
    1. sudo dpkg -i mysql-apt-config_w.x.y-zubuntu14.04_all.deb
    2. During the installation of the package, you will be asked to choose the versions of the MySQL server and other components (for example, the MySQL Workbench) that you want to install. If you are not sure which version to choose, do not change the default options selected for you. You can also choose none if you do not want a particular component to be installed. After making the choices for all components, choose Apply to finish the configuration and installation of the release package.
    3. 可以重新配置选择的软件包sudo dpkg-reconfigure mysql-apt-config
  3. sudo apt-get update(更新软件列表)点我查看更新了那些软件包
  4. sudo apt-get install package-name
  5. 安装 sudo apt-get install mysql-server

Starting and Stopping the MySQL Server

shell> sudo service mysql status

Stop the MySQL server with the following command:
shell> sudo service mysql stop

To restart the MySQL server, use the following command:
shell> sudo service mysql start

修改mysql编码为UTF8

登录mysql

mysql -u root -p

输入密码
查看编码

“`shell

 show variables like '%char%'+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

“`

修改编码
sudo vim /etc/mysql/my.cnf
[client]下添加
default-character-set=utf8
[mysql] 下添加
default-character-set=utf8
[mysqld]下添加
character-set-server=utf8

注意这里的utf8千万不能写成utf-8,mysql的字符集不识别utf-8

maven

去maven官网下载解压到制定目录即可

我的情况时这样的,之前ubuntu崩溃了,把里面的myeclipse和workspace拷贝出来重新安装ubuntu和maven,结果之前用maven管理的项目文件pom.xml报错:
“`java
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000

这篇关于Linux configure for java web developer的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1037120

相关文章

Linux流媒体服务器部署流程

《Linux流媒体服务器部署流程》文章详细介绍了流媒体服务器的部署步骤,包括更新系统、安装依赖组件、编译安装Nginx和RTMP模块、配置Nginx和FFmpeg,以及测试流媒体服务器的搭建... 目录流媒体服务器部署部署安装1.更新系统2.安装依赖组件3.解压4.编译安装(添加RTMP和openssl模块

Spring Cloud LoadBalancer 负载均衡详解

《SpringCloudLoadBalancer负载均衡详解》本文介绍了如何在SpringCloud中使用SpringCloudLoadBalancer实现客户端负载均衡,并详细讲解了轮询策略和... 目录1. 在 idea 上运行多个服务2. 问题引入3. 负载均衡4. Spring Cloud Load

linux下多个硬盘划分到同一挂载点问题

《linux下多个硬盘划分到同一挂载点问题》在Linux系统中,将多个硬盘划分到同一挂载点需要通过逻辑卷管理(LVM)来实现,首先,需要将物理存储设备(如硬盘分区)创建为物理卷,然后,将这些物理卷组成... 目录linux下多个硬盘划分到同一挂载点需要明确的几个概念硬盘插上默认的是非lvm总结Linux下多

Springboot中分析SQL性能的两种方式详解

《Springboot中分析SQL性能的两种方式详解》文章介绍了SQL性能分析的两种方式:MyBatis-Plus性能分析插件和p6spy框架,MyBatis-Plus插件配置简单,适用于开发和测试环... 目录SQL性能分析的两种方式:功能介绍实现方式:实现步骤:SQL性能分析的两种方式:功能介绍记录

在 Spring Boot 中使用 @Autowired和 @Bean注解的示例详解

《在SpringBoot中使用@Autowired和@Bean注解的示例详解》本文通过一个示例演示了如何在SpringBoot中使用@Autowired和@Bean注解进行依赖注入和Bean... 目录在 Spring Boot 中使用 @Autowired 和 @Bean 注解示例背景1. 定义 Stud

如何通过海康威视设备网络SDK进行Java二次开发摄像头车牌识别详解

《如何通过海康威视设备网络SDK进行Java二次开发摄像头车牌识别详解》:本文主要介绍如何通过海康威视设备网络SDK进行Java二次开发摄像头车牌识别的相关资料,描述了如何使用海康威视设备网络SD... 目录前言开发流程问题和解决方案dll库加载不到的问题老旧版本sdk不兼容的问题关键实现流程总结前言作为

SpringBoot中使用 ThreadLocal 进行多线程上下文管理及注意事项小结

《SpringBoot中使用ThreadLocal进行多线程上下文管理及注意事项小结》本文详细介绍了ThreadLocal的原理、使用场景和示例代码,并在SpringBoot中使用ThreadLo... 目录前言技术积累1.什么是 ThreadLocal2. ThreadLocal 的原理2.1 线程隔离2

springboot将lib和jar分离的操作方法

《springboot将lib和jar分离的操作方法》本文介绍了如何通过优化pom.xml配置来减小SpringBoot项目的jar包大小,主要通过使用spring-boot-maven-plugin... 遇到一个问题,就是每次maven package或者maven install后target中的ja

Java中八大包装类举例详解(通俗易懂)

《Java中八大包装类举例详解(通俗易懂)》:本文主要介绍Java中的包装类,包括它们的作用、特点、用途以及如何进行装箱和拆箱,包装类还提供了许多实用方法,如转换、获取基本类型值、比较和类型检测,... 目录一、包装类(Wrapper Class)1、简要介绍2、包装类特点3、包装类用途二、装箱和拆箱1、装

如何利用Java获取当天的开始和结束时间

《如何利用Java获取当天的开始和结束时间》:本文主要介绍如何使用Java8的LocalDate和LocalDateTime类获取指定日期的开始和结束时间,展示了如何通过这些类进行日期和时间的处... 目录前言1. Java日期时间API概述2. 获取当天的开始和结束时间代码解析运行结果3. 总结前言在J