ubuntu 设置汇总

1. ubuntu 分辨率

$ xrandr
$ xrandr -s 1024x768_60.00
上面可以即时更改分辨率

2. ubuntu加密文件夹

sudo apt-get install encfs

  • .media包含被加密的信息,当你想要访问信息的时候,解密后的文件将会挂载到media目录。

encfs ~/.media ~/media # 创建目录
echo "www.yto.cc and www.chachabei.com ." > ~/media/test.txt

  • 完成文件访问或者数据创建等操作,把加密文件夹卸载,即开始了隐藏

fusermount -u ~/media

  • 需要查看加密文件夹时,挂载用encfs创建的加密文件夹:

encfs ~/.media ~/media

3. ubuntu 修改主机名

root@ubuntu:~# hostname  mycms5.912616.com
root@ubuntu:~# vim /etc/hostname => mycms5.912616.com
root@ubuntu:~# vim /etc/hosts
127.0.1.1       ubuntu.912616.com ubuntu

4. ubuntu 安装rpm包

Ubuntu的软件包格式是deb,先用alien把rpm转换成deb格式
sudo apt-get install alien # 先安装alien
sudo alien *.rpm #将rpm转换位deb,完成后会生成一个同名的deb包
sudo dpkg -i *.deb #安装

5. 查看系统版本信息

root@ubuntu:~# uname -r
4.4.0-21-generic
root@ubuntu:~# uname -a
Linux ubuntu 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu:~# uname 
Linux
root@ubuntu:~# 
root@ubuntu:~# cat /proc/version
Linux version 4.4.0-21-generic (buildd@lgw01-21) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) ) #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016
root@ubuntu:~# cat /etc/issue
Ubuntu 16.04 LTS \n \l
root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:    16.04
Codename:   xenial
# 红帽
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)

#centos
# cat /etc/centos-release
# cat /etc/issue 也可以通过此文件查询

# ubuntu
# lsb_release -a

5. ubuntu 安装sqlplus

虚拟机系统版本为Ubuntu 16.04 LTS,挂载11.2.0.3-64bit.iso

root@ubuntu:/# mkdir oracle
root@ubuntu:/# mount /dev/cdrom /mnt
root@ubuntu:/# cd oracle/
root@ubuntu:/oracle# cp -r /mnt/oracle-instantclient11.2-* 
root@ubuntu:/oracle# apt install alien
root@ubuntu:/oracle# alien *.rpm 
root@ubuntu:/oracle# dpkg -i *.deb
root@ubuntu:/# apt install libaio.*
root@ubuntu:/# vim /etc/profile
export ORACLE_BASE=/usr/lib/oracle/11.2/client64
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

登陆sqlplus,如果提示

ERROR:ORA-12162: TNS:net service name is incorrectly specified

这是因为hostname 和 hosts 文件里的 hostname 不一致,修改一致即可,详见上面ubuntu修改主机名方法。

root@ubuntu:/# sqlplus scott/[email protected]:1522/wyzc11g
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 19 15:56:33 2018
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> 

ok,这里sqlplus已经可以正常登陆了。

配置服务名:

root@ubuntu:/usr/lib/oracle/11.2/client64# mkdir -p network/admin
root@ubuntu:/usr/lib/oracle/11.2/client64/network/admin# vim tnsnames.ora
WYZC11G =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.6)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = wyzc11g)
    )
  )

LISTENER_WYZC11G =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.6)(PORT = 1522))

安装插件: apt install rlwrap
在当前用户下设置一个命令别名: alias sqlplus='rlwrap sqlplus'
此时,sqlplus即可使用rlwrap插件翻页了。

你可能感兴趣的:(ubuntu 设置汇总)