您的位置:首页 > 数据库 > SQL

CentOS 6.4 FTP服务器及mysql数据库搭建

2013-11-29 21:49 573 查看
操作系统版本CentOs6.4,mysql版本Mysql5.1

1、开机启动,Secure CRT连接虚拟机,连接失败。解决办法:http://blog.csdn.net/jianglei421/article/details/6362928

#rpm -qa |grep ssh 检查是否装了SSH包
#chkconfig --list sshd 检查SSHD是否在本运行级别下设置为开机启动
#chkconfig --level 2345 sshd on  如果没设置启动就设置下.
#service sshd restart  重新启动
#netstat -antp |grep sshd  看是否启动了22端口.确认下.
#iptables -nL  看看是否放行了22口.
#setup---->防火墙设置   如果没放行就设置放行.
2、vsftpd服务器搭建

[root@livedvd /]# rpm -qa | grep vsftpd
[root@livedvd /]# chkconfig --list vsftpd
error reading information on service vsftpd: No such file or directory
[root@livedvd /]# yum install vsftpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
…………
Installed:
  vsftpd.i686 0:2.2.2-11.el6_4.1                                                

Complete!
在Windows上测试登录

C:\Users\Administrator.WIN-20121228FDJ>ftp 192.168.1.104
ftp>
ftp> ls
Not connected.
ftp> bye
测试不通,关闭防火墙或者是打开21和20端口

# /etc/init.d/iptables status//查看打开的端口:
//开启21、20端口
[root@livedvd forilen]# /sbin/iptables -I INPUT -p tcp --dport 21 -j ACCEPT
[root@livedvd forilen]# /sbin/iptables -I INPUT -p tcp --dport 20 -j ACCEPT 
[root@livedvd forilen]# /etc/rc.d/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@livedvd forilen]# service iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
再次在Windows上测试ftp登录

C:\Users\Administrator.WIN-20121228FDJ>ftp 192.168.1.104
Connected to 192.168.1.104.
220 (vsFTPd 2.2.2)
User (192.168.1.104:(none)): forilen
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/forilen
500 OOPS: priv_sock_get_cmd
Connection closed by remote host.
参考网络资料执行下面代码

[root@livedvd vsftpd]# getsebool -a |grep ftp
bash: /usr/sbin/getsebool: Input/output error
执行失败,参考Mr yangWaWa提示

[root@livedvd ~]# yum provides "*bin/setsebool"
Loaded plugins: fastestmirror, refresh-packagekit, security
base                                                     | 3.7 kB     00:00     
base/primary_db                                          | 3.4 MB     00:27     
extras                                                   | 3.5 kB     00:00     
extras/primary_db                                        |  19 kB     00:00     
updates                                                  | 3.4 kB     00:00     
updates/primary_db                                       | 4.7 MB     00:40     
base/filelists_db                                        | 4.9 MB     00:39     
extras/filelists_db                                      |  10 kB     00:00     
updates/filelists_db                                     | 3.9 MB     00:32     
policycoreutils-2.0.83-19.30.el6.i686 : SELinux policy core utilities
Repo        : base
Matched from:
Filename    : /usr/sbin/setsebool
接下来,开启vsftpd远程访问

[root@livedvd ~]# getsebool -a |grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> off
ftpd_connect_db --> off
ftpd_use_passive_mode --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
[root@livedvd ~]# setsebool ftpd_disable_trans 1
Could not change active booleans: Invalid boolean
[root@livedvd ~]# setsebool ftp_home_dir 1
[root@livedvd ~]# getsebool -a |grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> on
ftpd_connect_db --> off
ftpd_use_passive_mode --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
[root@livedvd ~]# service vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]
[root@livedvd ~]#
再次用Windows远程登录ftp

C:\Users\Administrator.WIN-20121228FDJ>ftp 192.168.1.104
Connected to 192.168.1.104.
220 (vsFTPd 2.2.2)
User (192.168.1.104:(none)): forilen
331 Please specify the password.
Password:
230 Login successful.
ftp>
登录成功,偶也 ^_^

3、配置mysql

[root@livedvd /]# rpm -qa | grep mysql
mysql-libs-5.1.66-2.el6_3.i686
qt-mysql-4.6.2-25.el6.i686
mysql-5.1.66-2.el6_3.i686
mysql-server-5.1.66-2.el6_3.i686
[root@livedvd /]# service mysqld status
mysqld is stopped
[root@livedvd /]# service mysqld start
Starting mysqld:                                           [  OK  ]
设置mysql初始密码

[root@livedvd /]# mysqladmin -u root password 'root'
[root@livedvd /]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@livedvd /]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>


真机安装redhat 5.4测试待续…… 14天倒计时
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: