BlueXIII's Blog

热爱技术,持续学习

0%

从启动U盘制作ISO镜像

1
sudo dd if=/dev/sdx of=/path/to/new.iso

从ISO镜像制作启动U盘

1
sudo dd if=/path/to/iso of=/dev/sdx

修改sansserif.conf

1
2
3
sudo cp /etc/fonts/conf.d/49-sansserif.conf /etc/fonts/conf.d/49-sansserif.conf.bak

sudo vi /etc/fonts/conf.d/49-sansserif.conf

倒数第4行:

1
<string>sans-serif</string>

改为

1
<string>sans</string>

其它相关操作

查看所有字体

1
fc-list

查看中文字体

1
fc-list :lang=zh-cn

下载地址

http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html

选择:
Instant Client for Linux x86-64

下载以下两个ZIP包:

  • instantclient-basic-linux.x64-12.2.0.1.0.zip
  • instantclient-sqlplus-linux.x64-12.2.0.1.0.zip

解压安装

1
2
3
unzip instantclient-basic-linux.x64-12.2.0.1.0.zip
unzip instantclient-sqlplus-linux.x64-12.2.0.1.0.zip
sudo mv instantclient_12_2 /opt/instantclient

环境变量

1
2
3
4
export ORACLE_HOME=/opt/instantclient
export LD_LIBRARY_PATH=/opt/instantclient
export TNS_ADMIN=/opt/instantclient
export PATH=$PATH:/opt/instantclient

Snap简介

Ubuntu 16.04引入了snap包管理,它是一种全新的软件包安装管理方式。它和dpkg/apt有本质的区别。
Snap的安装包扩展名是.snap,类似于一个容器,它包含一个应用程序需要用到的所有文件和库(snap包包含一个私有的root文件系统,里面包含了依赖的软件包)。它们会被安装到单独的目录;各个应用程序之间相互隔离。使用snap有很多好处,首先它解决了软件包的依赖问题;其次,也使应用程序更容易管理。

Snap安装

1
2
sudo apt update
sudo apt install snapd

Snap常用命令

1
2
3
4
5
6
snap list # 列出已安装
snap find # 查询
snap find app_name # 查询
sudo snap install app_name # 安装
sudo snap refresh john-the-ripper # 升级
sudo snap remove john-the-ripper # 御载

使用Snap安装Electronic微信

1
sudo snap install  electronic-wechat

参考文档

https://docs.snapcraft.io/core/install-ubuntu
https://www.zhihu.com/question/47514122
http://blog.topspeedsnail.com/archives/4733

基础准备

  • JDK
  • Hadoop
  • SSH Server

下载HBase

https://hbase.apache.org/

1
2
tar -zxvf hbase-1.4.2-bin.tar.gz
sudo mv hbase-1.4.2 /opt/hbase

系统环境变量

export HBASE_MANAGES_ZK=true
export HBASE_HOME=/opt/hbase
export PATH=$PATH:/opt/hbase/bin

写死JAVA_HOME

vi ./conf/hbase-env.sh

1
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre/

单机模式配置

vi hbase-site.xml

1
2
3
4
5
6
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///tmp/hbase-${user.name}/hbase</value>
</property>
</configuration>

伪分布模式配置

vi hbase-site.xml

1
2
3
4
5
6
7
8
9
10
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
</configuration>

启动Hadoop:

1
./start-all.sh

Hbase启停

启停:

1
2
./bin/start-hbase.sh
./bin/stop-hbase.sh

查看进程:

1
jps

WEB控制台:
http://localhost:45005/master-status

HBase Shell

1
2
./bin/hbase shell
help

常用命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
status
create 'test', 'cf'
list 'test'
describe 'test'

disable 'test'
drop 'test'
exists 'test'

put 'test', 'row1', 'cf:a', 'value1'
put 'test', 'row2', 'cf:b', 'value2'
put 'test', 'row3', 'cf:c', 'value3'

scan 'test'
get 'test', 'row1'

参考文档

https://www.jianshu.com/p/8818e8d40da4
https://www.jianshu.com/p/352213f109e5
https://www.shiyanlou.com/courses/37
https://www.ibm.com/developerworks/cn/analytics/library/ba-cn-bigdata-hbase/index.html

下载

http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html

Download
Oracle Database Express Edition 11g Release 2 for Linux x64

Copy the downloaded file and paste it in home directory.

Unzip using the command:

unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
Install required packages using the command:

sudo apt-get install alien libaio1 unixodbc
Enter into the Disk1 folder using command:

cd Disk1/
Convert RPM package format to DEB package format (that is used by Ubuntu) using the command:

sudo alien –scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm
Create the required chkconfig script using the command:

sudo pico /sbin/chkconfig
The pico text editor is started and the commands are shown at the bottom of the screen. Now copy and paste the following into the file and save:

#!/bin/bash

Oracle 11gR2 XE installer chkconfig hack for Ubuntu

file=/etc/init.d/oracle-xe
if [[ ! tail -n1 $file | grep INIT ]]; then
echo >> $file
echo ‘### BEGIN INIT INFO’ >> $file
echo ‘# Provides: OracleXE’ >> $file
echo ‘# Required-Start: $remote_fs $syslog’ >> $file
echo ‘# Required-Stop: $remote_fs $syslog’ >> $file
echo ‘# Default-Start: 2 3 4 5’ >> $file
echo ‘# Default-Stop: 0 1 6’ >> $file
echo ‘# Short-Description: Oracle 11g Express Edition’ >> $file
echo ‘### END INIT INFO’ >> $file
fi
update-rc.d oracle-xe defaults 80 01
Change the permission of the chkconfig file using the command:

sudo chmod 755 /sbin/chkconfig
Set kernel parameters. Oracle 11gR2 XE requires additional kernel parameters which you need to set using the command:

sudo pico /etc/sysctl.d/60-oracle.conf
Copy the following into the file and save:

Oracle 11g XE kernel parameters

fs.file-max=6815744
net.ipv4.ip_local_port_range=9000 65000
kernel.sem=250 32000 100 128
kernel.shmmax=536870912
Verify the change using the command:

sudo cat /etc/sysctl.d/60-oracle.conf
You should see what you entered earlier. Now load the kernel parameters:

sudo service procps start
Verify the new parameters are loaded using:

sudo sysctl -q fs.file-max
You should see the file-max value that you entered earlier.

Set up /dev/shm mount point for Oracle. Create the following file using the command:

sudo pico /etc/rc2.d/S01shm_load
Copy the following into the file and save.

#!/bin/sh
case “$1” in
start)
mkdir /var/lock/subsys 2>/dev/null
touch /var/lock/subsys/listener
rm /dev/shm 2>/dev/null
mkdir /dev/shm 2>/dev/null
*)
echo error
exit 1
;;

esac
Change the permissions of the file using the command:

sudo chmod 755 /etc/rc2.d/S01shm_load
Now execute the following commands:

sudo ln -s /usr/bin/awk /bin/awk
sudo mkdir /var/lock/subsys
sudo touch /var/lock/subsys/listener
Now, Reboot Your System

Step 3: Install Oracle
Install the oracle DBMS using the command:

sudo dpkg –install oracle-xe_11.2.0-2_amd64.deb
Configure Oracle using the command:

sudo /etc/init.d/oracle-xe configure
Setup environment variables by editting your .bashrc file:

pico ~/.bashrc
Add the following lines to the end of the file:

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=$ORACLE_HOME/bin/nls_lang.sh
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
Load the changes by executing your profile:

. ~/.bashrc
Start the Oracle 11gR2 XE:

sudo service oracle-xe start
Add user YOURUSERNAME to group dba using the command:

sudo usermod -a -G dba YOURUSERNAME
Step 4: Using the Oracle XE Command Shell
Start the Oracle XE 11gR2 server using the command:

sudo service oracle-xe start
Start command line shell as the system admin using the command:

sqlplus sys as sysdba
Enter the password that you gave while configuring Oracle earlier. You will now be placed in a SQL environment that only understands SQL commands.

Create a regular user account in Oracle using the SQL command:

create user USERNAME identified by PASSWORD;
Replace USERNAME and PASSWORD with the username and password of your choice. Please remember this username and password. If you had error executing the above with a message about resetlogs, then execute the following SQL command and try again:

alter database open resetlogs;
Grant privileges to the user account using the SQL command:

grant connect, resource to USERNAME;
Replace USERNAME and PASSWORD with the username and password of your choice. Please remember this username and password.

Exit the sys admin shell using the SQL command:

exit;
Start the commandline shell as a regular user using the command:

sqlplus
Now, you can run sql commands…

Installing Oracle XE by hand
Installing Oracle XE with Vagrant and Puppet
Installing Oracle XE with Docker

docker方式

https://tuhrig.de/3-ways-of-installing-oracle-xe-11g-on-ubuntu/
https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce-1
https://hub.docker.com/r/alexeiled/docker-oracle-xe-11g/

如果涉及macOS与Windows交换文件的话,在Windows会有一些无用的.DS_Store文件需要清理。

可以在gitbash/cygwin/cmder下执行如下命令清理:

1
find . -name '*.DS_Store' -type f -delete

最优配置

为了最大限度兼容macOS以及Linux,需要:

  1. 提交时转换为LF,检出时不转换
  2. 拒绝提交包含混合换行符的文件
    1
    2
    git config --global core.autocrlf input
    git config --global core.safecrlf true

    批量将CRLF转换成LF

    如果在Windows下不慎将部分文本的换行符写为CRLF,可以使用dos2unix工具修复回LF

在Cmder或Cywin下执行:

1
find . -type f|xargs dos2unix

IDE配置

注意及时将VS Code、IntelliJ IDEA等编辑器默认配置修改,将换行符置为LF!

附:autocrlf参数说明

1
2
3
4
5
6
7
8
# 提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true

# 提交时转换为LF,检出时不转换
git config --global core.autocrlf input

# 提交检出均不转换
git config --global core.autocrlf false

附:safecrlf参数说明

1
2
3
4
5
6
7
8
# 拒绝提交包含混合换行符的文件
git config --global core.safecrlf true

# 允许提交包含混合换行符的文件
git config --global core.safecrlf false

# 提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn