LAMP+Proftpd+数据迁移
on Centos 6.5 64bit minimal
安装mysql
[root@ftp ~]# yum install -y mysql mysql-server mysql-devel --安装
[root@ftp ~]# /etc/init.d/mysqld start --启动
[root@ftp ~]#/usr/bin/mysql_secure_installation --初始化
[root@ftp ~]# chkconfig --levels 235 mysqld on --235level启动
[root@ftp ~]# chkconfig --list |grep mysqld --look look
mysqld 0:off 1:off 2:on 3:on 4:off 5:on 6:off
安装apache
[root@ftp ~]# yum install -y httpd --安装
[root@ftp ~]# /etc/init.d/httpd start --启动
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name... ... --在/etc/httpd/conf/httpd.conf 加入"ServerName localhost:80"或本地域名解析
[root@ftp ~]# chkconfig --levels 235 httpd on --启动
[root@ftp ~]# chkconfig --list |grep httpd --look look
httpd 0:off 1:off 2:on 3:on 4:off 5:on 6:off
[root@ftp html]# pwd
/var/www/html --这是www根目录
安装PHP
[root@ftp ~]# yum install -y php --安装
[root@ftp ~]# yum install -y php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc --mysql关联
[root@ftp ~]# service httpd restart --重启httpd服务使php生效,验证php安装是否正确http://localhost/info.php(需建立info.php文件)
[root@ftp ~]# vi /var/www/html/info.php #建立php文件内容如下
<?
phpphpinfo();
?>
安装第三方源
http://pkgs.repoforge.org/rpmforge-release/ --Ctrl+F找到Centos6的对应rpm包
[root@ftp tmp]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-1.el6.rf.x86_64.rpm --下载它
[root@ftp tmp]# wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt --下载验证(可以了解下GPG)
[root@ftp tmp]# rpm --import RPM-GPG-KEY.dag.txt --导入验证文件
[root@ftp tmp]# rpm -ivh rpmforge-release-0.5.2-1.el6.rf.x86_64.rpm --安装它
安装proftpd(一定要编译安装,并安装mysql支持)
[root@ftp ~]# yum install -y gcc make --安装编译所需要的工具
[root@ftp ~]# whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
[root@ftp ~]# which mysql
/usr/bin/mysql
[root@ftp home]# gunzip -c proftpd-1.3.5.tar.gz | tar xf -
[root@ftp home]# cd proftpd-1.3.5
[root@ftp proftpd-1.3.5]# ./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \
> --enable-nls \
> --with-includes=/usr/include/mysql \
> --with-libraries=/usr/bin/mysql \
> --prefix=/usr/local/proftpd
[root@ftp proftpd-1.3.5]# make
[root@ftp proftpd-1.3.5]# make install
[root@ftp ~]# vim /usr/local/proftpd/etc/proftpd.conf --配置
1 # This is a basic ProFTPD configuration file (rename it to
2 # 'proftpd.conf' for actual use. It establishes a single server
3 # and a single anonymous login. It assumes that you have a user/group
4 # "nobody" and "ftp" for normal operation and anon.
5
6 ServerName "ProFTPD Default Installation"
7 ServerType standalone
8 DefaultServer on
9
10 # Port 21 is the standard FTP port.
11 Port 21
12
13 # Don't use IPv6 support by default.
14 UseIPv6 off
15
16 # Umask 022 is a good standard umask to prevent new dirs and files
17 # from being group and world writable.
18 Umask 002
19
20 # To prevent DoS attacks, set the maximum number of child processes
21 # to 30. If you need to allow more than 30 concurrent connections
22 # at once, simply increase this value. Note that this ONLY works
23 # in standalone mode, in inetd mode you should use an inetd server
24 # that allows you to limit maximum number of processes per service
25 # (such as xinetd).
26 MaxInstances 30
27
28 # Set the user and group under which the server will run.
29 User nobody
30 Group nobody
31
32 # To cause every FTP user to be "jailed" (chrooted) into their home
33 # directory, uncomment this line.
34 DefaultRoot ~
35
36 # Normally, we want files to be overwriteable.
37 AllowOverwrite on
38
39 # Bar use of SITE CHMOD by default
40 <Limit SITE_CHMOD>
41 DenyAll
42 </Limit>
43
44 # A basic anonymous configuration, no upload directories. If you do not
45 # want anonymous users, simply delete this entire <Anonymous> section.
46 #<Anonymous ~ftp>
47 # User ftp
48 # Group ftp
49
50 # We want clients to be able to login with "anonymous" as well as "ftp"
51 # UserAlias anonymous ftp
52
53 # Limit the maximum number of anonymous logins
54 # MaxClients 10
55
56 # We want 'welcome.msg' displayed at login, and '.message' displayed
57 # in each newly chdired directory.
58 # DisplayLogin welcome.msg
59 # DisplayChdir .message
60
61 # Limit WRITE everywhere in the anonymous chroot
62 # <Limit WRITE>
63 # DenyAll
64 # </Limit>
65 #</Anonymous>
66
67
68 #数据库连接
69 SQLBackend mysql
70 # The passwords in MySQL are encrypted using CRYPT
71 SQLAuthTypes Plaintext Crypt
72 SQLAuthenticate users groups
73
74 # used to connect to the database
75 # databasename@host database_user user_password
76 SQLConnectInfo ftp@localhost proftpd your_password
77
78 # Here we tell ProFTPd the names of the database columns in the "usertable"
79 # we want it to interact with. Match the names with those in the db
80 SQLUserInfo ftpuser userid passwd uid gid homedir shell
81
82 # Here we tell ProFTPd the names of the database columns in the "grouptable"
83 # we want it to interact with. Again the names match with those in the db
84 SQLGroupInfo ftpgroup groupname gid members
85
86
87 # set min UID and GID - otherwise these are 999 each
88 SQLMinID 500
89
90 # create a user's home directory on demand if it doesn't exist
91 CreateHome on
92
93 # Update count every time user logs in
94 SQLLog PASS updatecount
95 SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser
96
97 # Update modified everytime user uploads or deletes a file
98 SQLLog STOR,DELE modified
99 SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser
100
101 RootLogin off
102 RequireValidShell off
103 #UseEncoding UTF-8 CP936
104 #禁止删除文件,可删除空文件夹。
105 <Directory /home/ftp/*>
106 <Limit DELE >
107 DenyUser rdd1,rdd2,rdd3,amd,fd,wsd,csd,std,asd,ftp
108 </Limit>
109 </Directory>
数据库(ftp)的表结构
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ftp |
+--------------------+
2 rows in set (0.00 sec)
mysql> use ftp;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+---------------+
| Tables_in_ftp |
+---------------+
| ftpgroup |
| ftpuser |
+---------------+
2 rows in set (0.00 sec)
mysql> desc ftpgroup;
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| groupname | varchar(16) | NO | MUL | | |
| gid | smallint(6) | NO | | 5500 | |
| members | varchar(16) | NO | | | |
+-----------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> desc ftpuser;
+----------+------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------+------+-----+---------------------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| userid | varchar(32) | NO | UNI | | |
| passwd | varchar(32) | NO | | | |
| uid | smallint(6) | NO | | 5500 | |
| gid | smallint(6) | NO | | 2001 | |
| homedir | varchar(255) | NO | | | |
| shell | varchar(16) | NO | | /sbin/nologin | |
| count | int(11) | NO | | 0 | |
| accessed | datetime | NO | | 0000-00-00 00:00:00 | |
| modified | datetime | NO | | 0000-00-00 00:00:00 | |
+----------+------------------+------+-----+---------------------+----------------+
10 rows in set (0.00 sec)
mysql数据库的备份与恢复
[root@amd240 ~]# mysqldump -u root -p --all-databases > all.sql --备份全部数据库
Enter password:
-- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly. --提示这个是因为mysql默认是不备份事件表的。加上--events --ignore-table=mysql.events参数即可;
/usr/local/mysql/bin/mysqldump -uroot -p --events --ignore-table=mysql.events --all-databases > all.sql
[root@ftp ~]# mysql -u root -p < /home/all.sql --恢复备份数据(恢复时数据库要开启,完成后需要重启生效)
加用户和组
[root@ftp ~]# groupadd -g 2001 ftpgroup
[root@ftp ~]# useradd -u 2001 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser
[root@ftp ~]# cat /etc/passwd |grep ftpuser
ftpuser:x:2001:2001:proftpd user:/bin/null:/bin/false
[root@ftp ~]# cat /etc/group |grep ftpgroup
ftpgroup:x:2001:
copy原ftp目录到新服务器(注意带属性copy及目录的权限和属组信息等)
# scp -prv /home/ftp root@yourhostname_or_IPaddr:/home/
必要时,需要手动修改各目录的属组
启动proftpd
[root@ftp ~]# /usr/local/proftpd/sbin/proftpd
[root@ftp ~]# pgrep proftpd
10573 --有进程号说明服务起来了
proftpd -nd6 --启动可以查看错误信息
proftpd -l --查看当前支持的模块 如是否支持mysql
以下是扩展的知识
一般使用mysqldump来备份和恢复,常用的几种常法:
(1)导出整个数据库(包括数据库中的数据)
mysqldump -u username -p dbname > dbname.sql
(2)导出数据库结构(不含数据)
mysqldump -u username -p -d dbname > dbname.sql
(3)导出数据库中的某张数据表(包含数据)
mysqldump -u username -p dbname tablename > tablename.sql
(4)导出数据库中的某张数据表的表结构(不含数据)
mysqldump -u username -p -d dbname tablename > tablename.sql
(5)如要对数据进行还原,可执行如下命令:
mysql -u username -p test_db < test_db.sql
参考资料
http://blog.xuite.net/tunedgr01/knowledge/6378500-RedHat+-+Proftpd+%2B+MySQL+authentication+%2B+Quotas++
LAMP+Proftpd+数据迁移的更多相关文章
- 【SQLServer】记一次数据迁移-标识重复的简单处理
汇总篇:http://www.cnblogs.com/dunitian/p/4822808.html#tsql 今天在数据迁移的时候因为手贱遇到一个坑爹问题,发来大家乐乐,也传授新手点经验 迁移惯用就 ...
- Entity Framework Code First Migrations--EF 的数据迁移
1. 为了演示方便,首先新建一个控制台项目,然后添加对entityframework的引用 使用nuget控制台执行: Install-Package EntityFramework 2.新建一个实体 ...
- mssql与mysql 数据迁移
概要: mssql向mysql迁移的实例,所要用到的工具bcp和load data local infile. 由于订单记录的数据是存放在mssql服务器上的,而项目需求把数据迁移到mysql ser ...
- 重置EntityFramework数据迁移到洁净状态
前言 翻译一篇有关EF数据迁移的文章,以备日后所用,文章若有翻译不当的地方请指出,将就点看,废话少说,看话题.[注意]:文章非一字一句的翻译,就重要的问题进行解释并解决. 话题引入 无法确定这种场景是 ...
- MySQL数据迁移到SQL Server
数据迁移的工具有很多,基本SSMA团队已经考虑到其他数据库到SQL Server迁移的需求了,所以已经开发了相关的迁移工具来支持. 此博客主要介绍MySQL到SQL Server数据迁移的工具:SQL ...
- MySQL数据迁移到MSSQL-以小米数据库为例-测试828W最快可达到2分11秒
这里采用.NET Framework 4.0以上版本中新出现的 ConcurrentQueue<T> 类 MSDN是这样描述的: ConcurrentQueue<T> 类是一个 ...
- 从零自学Hadoop(16):Hive数据导入导出,集群数据迁移上
阅读目录 序 导入文件到Hive 将其他表的查询结果导入表 动态分区插入 将SQL语句的值插入到表中 模拟数据文件下载 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并 ...
- 从零自学Hadoop(17):Hive数据导入导出,集群数据迁移下
阅读目录 序 将查询的结果写入文件系统 集群数据迁移一 集群数据迁移二 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephis ...
- SQL SERVER几种数据迁移/导出导入的实践
SQLServer提供了多种数据导出导入的工具和方法,在此,分享我实践的经验(只涉及数据库与Excel.数据库与文本文件.数据库与数据库之间的导出导入). (一)数据库与Excel 方法1: 使用数据 ...
随机推荐
- DataInputStream和DataOutputStream使用方法细节探讨
DataInputStream和DataOutputStream都是Java中输入输出流的装饰类,用起来非常方便.今天就来讨论一下使用该类时候遇到的编码问题. package com.vince ...
- android activity 跳转传值问题研究
intent = new Intent(); intent.setClass(LoginActivity.this, RegActivity.class); startActivity(intent) ...
- 离线安装Android开发环境的方法
对于大家从官网上下载下来的SDK其实是一个安装工具,里面啥都没有,如果在线安装的话会需要很长时间.我们同样可以从网络上用下载工具将所需要安装的东西下载下来,(同样有劳大家自己动手找找了)然后直接放入相 ...
- iOS开发——动画OC篇&知识点总结
图层与动画知识点总结 1.Core Animation 非娱乐类的软件都会用到的动画,操作简单. 2.Quartz 2D绘图 是一个2D绘图引擎. (1) 绘图Context是一个绘图的目标对象,定义 ...
- JavaScript针对Dom相关的优化心得
JavaScript针对Dom相关的优化心得 组内同时总结的关于javascript性能优化注意些节.记录一下. 1. 批量增加 Dom 尽量使用修改 innerHTML 的方式而不是用 append ...
- Java开发核心技术面试心得分析
Java的数据结构有哪些?Map与Set的本质区别是什么? 分析:Java常见的数据结构有Collection和Map,其中Collection接口下包括List和Set接口,其下又有多个实现类如Li ...
- Android 高级UI设计笔记14:Gallery(画廊控件)之 3D图片浏览
1. 利用Gallery组件实现 3D图片浏览器的功能,如下: 2. 下面是详细的实现过程如下: (1)这里我是测试性代码,我的图片是自己添加到res/drawable/目录下的,如下: 但是开发中不 ...
- 如何利用OCS存取PHP session全局变量
如何利用OCS存取PHP session全局变量 阿里云技术团队:余汶龙 一.场景介绍 用户在利用PHP搭建网站时,会把一些信息存放在$_SESSION全局变量里,可以很方便的存取.在PHP的in ...
- leetcode题解:Binary Tree Postorder Traversal (二叉树的后序遍历)
题目: Given a binary tree, return the postorder traversal of its nodes' values. For example:Given bina ...
- Oracle基础<5>--触发器
一.触发器 触发器是当特定事件出现时自动执行的代码块.比如,每次对员工表进行增删改的操作时,向日志表中添加一条记录.触发器和存储过程是由区别的:触发器是根据某些条件自动执行的,存储过程是手动条用的. ...