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

相关文章

Spring boot整合dubbo+zookeeper的详细过程

《Springboot整合dubbo+zookeeper的详细过程》本文讲解SpringBoot整合Dubbo与Zookeeper实现API、Provider、Consumer模式,包含依赖配置、... 目录Spring boot整合dubbo+zookeeper1.创建父工程2.父工程引入依赖3.创建ap

Linux线程之线程的创建、属性、回收、退出、取消方式

《Linux线程之线程的创建、属性、回收、退出、取消方式》文章总结了线程管理核心知识:线程号唯一、创建方式、属性设置(如分离状态与栈大小)、回收机制(join/detach)、退出方法(返回/pthr... 目录1. 线程号2. 线程的创建3. 线程属性4. 线程的回收5. 线程的退出6. 线程的取消7.

Linux下进程的CPU配置与线程绑定过程

《Linux下进程的CPU配置与线程绑定过程》本文介绍Linux系统中基于进程和线程的CPU配置方法,通过taskset命令和pthread库调整亲和力,将进程/线程绑定到特定CPU核心以优化资源分配... 目录1 基于进程的CPU配置1.1 对CPU亲和力的配置1.2 绑定进程到指定CPU核上运行2 基于

SpringBoot结合Docker进行容器化处理指南

《SpringBoot结合Docker进行容器化处理指南》在当今快速发展的软件工程领域,SpringBoot和Docker已经成为现代Java开发者的必备工具,本文将深入讲解如何将一个SpringBo... 目录前言一、为什么选择 Spring Bootjavascript + docker1. 快速部署与

golang程序打包成脚本部署到Linux系统方式

《golang程序打包成脚本部署到Linux系统方式》Golang程序通过本地编译(设置GOOS为linux生成无后缀二进制文件),上传至Linux服务器后赋权执行,使用nohup命令实现后台运行,完... 目录本地编译golang程序上传Golang二进制文件到linux服务器总结本地编译Golang程序

Linux下删除乱码文件和目录的实现方式

《Linux下删除乱码文件和目录的实现方式》:本文主要介绍Linux下删除乱码文件和目录的实现方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux下删除乱码文件和目录方法1方法2总结Linux下删除乱码文件和目录方法1使用ls -i命令找到文件或目录

Spring Boot spring-boot-maven-plugin 参数配置详解(最新推荐)

《SpringBootspring-boot-maven-plugin参数配置详解(最新推荐)》文章介绍了SpringBootMaven插件的5个核心目标(repackage、run、start... 目录一 spring-boot-maven-plugin 插件的5个Goals二 应用场景1 重新打包应用

SpringBoot+EasyExcel实现自定义复杂样式导入导出

《SpringBoot+EasyExcel实现自定义复杂样式导入导出》这篇文章主要为大家详细介绍了SpringBoot如何结果EasyExcel实现自定义复杂样式导入导出功能,文中的示例代码讲解详细,... 目录安装处理自定义导出复杂场景1、列不固定,动态列2、动态下拉3、自定义锁定行/列,添加密码4、合并

Spring Boot集成Druid实现数据源管理与监控的详细步骤

《SpringBoot集成Druid实现数据源管理与监控的详细步骤》本文介绍如何在SpringBoot项目中集成Druid数据库连接池,包括环境搭建、Maven依赖配置、SpringBoot配置文件... 目录1. 引言1.1 环境准备1.2 Druid介绍2. 配置Druid连接池3. 查看Druid监控

Linux在线解压jar包的实现方式

《Linux在线解压jar包的实现方式》:本文主要介绍Linux在线解压jar包的实现方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux在线解压jar包解压 jar包的步骤总结Linux在线解压jar包在 Centos 中解压 jar 包可以使用 u