debian系统安装后的一些环境配置

发布时间:2020-05-23编辑:脚本学堂
本文介绍下,在debian系统安装后,要进行的一些初始配置工作,以及mysql数据库的安装与配置等操作,感兴趣的朋友参考学习下。

本节内容:
debian系统环境配置

具体操作如下:
 

复制代码 代码示例:

#安装setuptools:
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python ez_setup.py --user

#163源:
deb http://mirrors.163.com/debian squeeze main contrib non-free
deb-src http://mirrors.163.com/debian squeeze main contrib non-free
deb http://mirrors.163.com/debian squeeze-proposed-updates main contrib non-free
deb-src http://mirrors.163.com/debian squeeze-proposed-updates main contrib non-free
deb http://mirrors.163.com/debian-security squeeze/updates main contrib non-free
deb-src http://mirrors.163.com/debian-security squeeze/updates main contrib non-free

#字体:
apt-get install ttf-wqy-zenhei

#nginx:
apt-get install libpcre3 libpcre3-dev
apt-get install zlib1g-dev
./configure --prefix=/usr/local/nginx --with-http_ssl_module
make && make install

#memcached:
./configure --prefix=/usr/local/libevent && make && make install
./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent && make && make install

#uwsgi:
apt-get install python-dev
apt-get install python-pip
pip install http://projects.unbit.it/downloads/uwsgi-lts.tar.gz

#提示出现mysql_config错误:
apt-get install libmysqld-dev

#mysql 设置编码:
set character_set_client=utf8;
set character_set_connection=utf8;
set character_set_database=utf8;
set character_set_results=utf8;
set character_set_server=utf8;

数据库及表转换成utf编码
 

复制代码 代码示例:
#转换
alter table table_name convert to character set utf8;
#和上面的不同,这个应该是设置编码
alter database database_name character set utf8;
alter table table_name character set utf8;

创建时指定编码:
 

复制代码 代码示例:
#创建数据库
create database name character set utf8;
#创建表
CREATE TABLE 'type' (
`id` int(10) unsigned NOT NULL auto_increment,
`flag_deleted` enum('Y','N') character set utf8 NOT NULL default 'N',
`flag_type` int(5) NOT NULL default '0',
`type_name` varchar(50) character set utf8 NOT NULL default '',
PRIMARY KEY (`id`)
)  DEFAULT CHARSET=utf8;

查看字符编码:
 

复制代码 代码示例:
SHOW VARIABLES LIKE 'character_set_%';
SHOW VARIABLES LIKE 'collation_%';

数据库设置:
 

复制代码 代码示例:
#找到客户端配置[client] 在下面添加
default-character-set=utf8 #默认字符集为utf8
#在找到[mysqld] 添加
character-set-server=utf8 #默认字符集为utf8
init-connect='SET NAMES utf8' #(设定连接mysql数据库时使用utf8编码,以让mysql数据库为utf8运行)