CentOS 使用常用的一些TIPs

设置代理

设置完代理需要reboot 或者 logout

yum 设置代理

sudo vim /etc/yum.conf
# 添加如下配置
proxy=http://proxy_addr:port

怎样截屏

Application >> serach "ScreenShot"

安装输入法包

sudo yum install  ibus-libpinyin

设置输入法

在这里插入图片描述

设置环境变量

# Centos 貌似只有在/etc/bashrc里面添加的环境变量,才能是shell脚本访问到
# 所以一般我们可以将需要export的环境变量添加到/etc/bashrc里面, 然后在source /etc/bashrc 即可
在/etc/profile里配置的环境变量只要退出后都需要再source /etc/profile才会生效。
解决办法:

编辑vi ~/.bashrc 再最后面增加
if [ -f /etc/profile ]; then
. /etc/profile
fi

/etc/profile、/etc/bashrc, ~/.bash_profile, ~/.bashrc四个文件在环境变量中的区别与作用:

文件描述
/etc/profile用来设置系统环境(参)变(数)量,比如$PATH. 这里面的环境变量是对系统内所有用户生效的。
/etc/bashrc这个文件设置系统-bash shell相关的,对系统内所有用户生效。只要用户运行bash命令,那么这里面的东西就在起作用。
~/.bash_profile用来设置一些环境变量,功能和/etc/profile 类似,但是这个是用户级别来设定的,也就是说,你在/home/{username}/.bash_profile 中设定了环境变量,那么这个环境变量只针对这个用户生效. 是交互式、login 方式进入 bash 运行的意思是只有用户登录时才会生效。
~/.bashrc作用类似于/etc/bashrc, 只是针对当前用户有效,不对其他用户生效。 ~/.bashrc等中设定的变量是局部只能继承/etc/profile中的变量,他们是"父子"关系 , 是交互式 non-login 方式进入 bash 运行的,用户不一定登录,只要以该用户身份运行命令行就会读取该文件

install android studio

Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source)
at java.awt.Window.init(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at oracle.ewt.popup.PopupFrame.<init>(Unknown Source)
at oracle.ewt.lwAWT.BufferedFrame.<init>(Unknown Source)
at oracle.sysman.oio.oioc.OiocOneClickInstaller.<init>(OiocOneClickInstaller.java:378)
at oracle.sysman.oio.oioc.OiocOneClickInstaller.main(OiocOneClickInstaller.java:2091)
If the Java program is running under your own account then the problem comes from DISPLAY being incorrectly defined. Try this:
Code:

export DISPLAY=":0.0"

If a different user account is running the program then the user account that "owns" the console must add permission for others to display on "their" X display. Try this:
Code:

xhost +local:all

If the program is being used on a different computer, say 192.168.3.5 then try this:
Code:

xhost +inet:192.168.3.5

I use these all the time on my main computer. I have three concurrent different users sharing the X display and I occasionally display something from another computer. I put the xhost commands in the .bashrc file of the user that owns the display so the xhost permissions are set automatically when I start a terminal window.

install adb

Installing ADB on Centos 7 / RHEL
by Lima | Posted on March 24, 2019
ADB or Android Debug Bridge, is a command line utility that let’s us control an android device from the computer itself.  It’s part of Google Android SDK & can be used to run shell commands or to copy the files to & from the device & also to install or remove the applications from device.

For Centos 7 / RHEL:

1
yum install android-tools
For Ubuntu:

1
sudo apt-get install android-tools-adb android-tools-fastboot
We want to make sure that ADB is now working. First, see to it that your Android device is set up for debugging. On your Android device, go to the Settings > Applications > Development screen and make sure “USB Debugging” is checked.

1
2
3
[root@nuuk /]# adb version
Android Debug Bridge version 1.0.31
[root@nuuk /]#

Install Kernel Sources and Headers in RedHat/CentOS

https://www.unixtutorial.org/how-to-install-kernel-source-code-in-centos-redhat/
yum install kernel-devel kernel-headers
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值