Press "Enter" to skip to content

月与灯依旧 Posts

RedHat/CentOS安装五笔输入法

使用centos 仓库里的 ibus,我的 CenOS6.3 自带了 ibus 包。打开 System – preferences – Input Method 配置 ibus 开机自启动。

要安装五笔需要安装一个 ibus-table-wubi 包

yum install ibus libusb ibus-libs ibus-table-wubi

安装好后注销一下系统,让ibus读取新的配置,然后就可以在ibus的设置界面添加wubi了

右击桌面右上角的输入法图标,选择 Preferences,切换到 Input Method 选项卡,在 Select a input method 下拉菜单里添加五笔输入法即可。

3 Comments

RedHat5.5使用xming安装Oracle 10g R2

RedHat5.5/CentOS5.5使用xming安装Oracle 10g Release2版,记录一下。

一,准备工作

1,设置好主机名,并且在windows系统中安装xming

2,安装基本包

# yum install -y gcc make binutils openmotif setarch compat-db compat-gcc 
# yum install -y compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel libXp

3,修改linux和oracle10g的系统兼容性
oracle 的官方只支持到Red Hat Release 4为止,所以要修改版本。这里有两种方法:1.修改linux版本;2.修改oracle配置;

方法1:修改linux版本

# vi /etc/redhat-release
将Red Hat Enterprise Linux Server release 5.5 (Tikanga)注释掉(前加”#”即可),然后添加一行:redhat-4

方法2:修改oracle安装文件的配置信息
oracle解压后是一个database目录,编辑database/install/oraparam.ini,找到[Certified Versions]段,将下面一行内容修改为

Linux=redhat-3,SuSE-9,redhat-4,redhat-5.5,UnitedLinux-1.0,asianux-1,asianux-2

并添加如下几行

[Linux-redhat-5.0-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256

4,修改内核参数

1 Comment

linux下安装中文字体

装了redhat 5后发现,安装系统时没安装中文字体,没办法显示中文网页,都是乱码。
上网找到了安装的方法,步骤如下:
1.windows的字体一般存放在c:\windows\fonts目录下,copy你要的字体到linux下,文件是

ttf格式
2.把字体copy到/usr/share/fonts 目录下,然后执行以下命令
mkfontscale
mkfontdir//这两条命令是生成字体的索引信息
fc-cache //更新字体缓存
3.安装好了,可以查看中文网页了

via

Leave a Comment

RedHat5.5配置安装lnmp全过程(Linux+Nginx+Mysql+PHP)

一,安装必要的库和相关软件

# rpm -e mysql-server php-mysql php perl-DBD-MySQL mysql httpd
# yum -y install gcc gcc-c++ autoconf libtool* ncurses-devel pcre-devel zlib-devel libxml2-devel libpng-devel libjpeg-devel-6b freetype-devel gd-devel curl-devel libmcrypt-devel bison

# wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz   #下载cmake
# tar -zxvf cmake-2.8.4.tar.gz
# cd cmake-2.8.4
# ./configure && make && make install

二,安装mysql

Leave a Comment

MySQL Usage

1. Database and User Management

Create Database

# Create a database (replace '<DB NAME>' to your Database name)
CREATE DATABASE <DB NAME> CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;


# Delete a database
drop database <DB NAME>;

Create User and Grant Permission

# Create a user and grant the database's permission to it

# MySQL 5.5, 5.6, and 5.7
grant all privileges on <DB NAME>.* to '<USER_NAME>'@'localhost' identified by '<PASSWORD>';
GRANT select,update ON <DB NAME>.* TO '<USER_NAME>'@'localhost' identified by '<PASSWORD>';
flush privileges;


# MySQL 8.0 or later (the use of the IDENTIFIED BY clause with GRANT is deprecated.) 
# Instead, you should use CREATE USER and ALTER USER statements to create and modify users
CREATE USER '<USER_NAME>'@'localhost' IDENTIFIED WITH mysql_native_password BY '<PASSWORD>';
GRANT ALL PRIVILEGES ON <DB NAME>.* TO '<USER_NAME>'@'localhost';
flush privileges;


# Delete a user
DELETE FROM mysql.user WHERE User="<USER_NAME>" and Host="localhost";
flush privileges;


# Change Password
update mysql.user set password=password('<NEW_PASSWORD>') where User="<USER_NAME>" and Host="localhost";
flush privileges;

See the User’s Permission

show grants for <USER_NAME>@localhost;

2. DATABASE and Table Management

# Check a DB's Charset and Collection
SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME
FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '<DB NAME>';


# Alter a DB's charset and Collection
ALTER DATABASE <DB NAME> CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;


# Check the DB size
SELECT table_schema "DB Name",
        ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM information_schema.tables GROUP BY table_schema; 


# Check the Table size (replace myDB with your DB name)
SELECT TABLE_NAME, table_rows, data_length, index_length, 
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "<DB NAME>" ORDER BY (data_length + index_length) DESC;


# Optimize Table
OPTIMIZE TABLE <table name>;
OPTIMIZE TABLE <table 1>, <table 2>, <table 3>;

# Optimize Tables Using the Terminal
mysqlcheck -u root -p --auto-repair --optimize --myDB  # For a Single DB
mysqlcheck -u root -p --auto-repair --optimize --all-databases

3. Optimize Table

use <DB NAME>;

# Find tables need to be optimized
select table_name, data_length, data_free from information_schema.tables
where table_schema='<DB NAME>' order by data_free desc;
+-----------------------------------+-------------+-----------+
| table_name                        | data_length | data_free |
+-----------------------------------+-------------+-----------+
| wordpress_commentmeta             |       44028 |     19784 |
| wordpress_comments                |     2005588 |     13024 |
| wordpress_postmeta                |      569124 |       112 |
| wordpress_links                   |        1220 |         0 |
| wordpress_aioseo_posts            |       16384 |         0 |
| wordpress_terms                   |       38876 |         0 |
| wordpress_tla_rss_map             |           0 |         0 |
| wordpress_actionscheduler_groups  |       16384 |         0 |

the output shows some general information about the table. The following two numbers are important:

  • Data_length represents the amount of space the database takes up in total.
  • Data_free shows the allocated unused bytes within the database table. This information helps identify which tables need optimization and how much space will be released afterward.
optimize table wordpress_commentmeta, wordpress_comments;

# Check tables again
select table_name, data_length, data_free from information_schema.tables
where table_schema='<DB NAME>' order by data_free desc;
+-----------------------------------+-------------+-----------+
| table_name                        | data_length | data_free |
+-----------------------------------+-------------+-----------+
| wordpress_commentmeta             |       44028 |         0 |
| wordpress_comments                |     2005588 |         0 |
| wordpress_postmeta                |      569124 |       112 |
| wordpress_links                   |        1220 |         0 |
| wordpress_aioseo_posts            |       16384 |         0 |
| wordpress_terms                   |       38876 |         0 |
| wordpress_tla_rss_map             |           0 |         0 |
| wordpress_actionscheduler_groups  |       16384 |         0 |

The results of the optimization change the values of data_length and data_free of the optimized table. Both values are lowered, indicating:

1. The optimization freed the unused allocated memory.
2. The overall memory of the database is lower because of the released space.

3 Comments

在CentOS/RedHat中使用bind搭建主域名服务器

在CentOS/RedHat中使用bind搭建主域名服务器,记录一下。

1,安装必要软件

yum install bind bind-utils bind-chroot caching-nameserver -y

其中,bind是主程序,bind-utils提供测试工具(如nslookup等),bind-chroot提供伪装目录增强安全性,caching-nameserver是作为缓存域名服务器的。
安装完成以后,bind在系统中的服务名为named,可以通过以下方式来启动服务:

service named start
或者 /etc/init.d/named start

2,配置
因为安装了bind-chroot,故named的主配置文件位于/var/named/chroot/etc/,但目前没有配置文件,需要手动创建一个

Leave a Comment