<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > CentOS64+Qt+Mysql+ftp+無密鑰傳輸?shù)呐渲迷敿氝^程

          CentOS64+Qt+Mysql+ftp+無密鑰傳輸?shù)呐渲迷敿氝^程

          作者: 時間:2016-10-08 來源:網(wǎng)絡(luò) 收藏

          這兩天單位要部一個環(huán)境.CentOS64+Qt+Mysql+ftp+的.

          本文引用地址:http://www.ex-cimer.com/article/201610/305991.htm

          有段日了沒裝系統(tǒng)了..呵呵..

          命令忘的都差不多了..記錄一下.

          ############################################################################################

          # 1. CentOS yum源

          ############################################################################################

          # 掛載兩個ISO

          將第一個盤的ISO1文件拷貝到ISO2中,進行掛載.

          [base-centos]

          name=CentOS

          baseurl=file:///mnt/iso

          gpgcheck=0

          enabled=1

          # 安裝gcc,java

          yum intall -y gcc*

          yum intall -y java*

          # 關(guān)閉防火墻

          關(guān)閉:

          chkconfig iptables off

          selinuxenabled 0

          ############################################################################################

          # 2. 安裝MYSQL-5.1.66

          ############################################################################################

          # 好yum源后,yum install -y mysql*

          # 啟動mysql

          service mysqld start

          mysql -h192.168.2.18 -uroot -p111

          # 查看監(jiān)聽端口

          netstat -tnlp |grep :3306

          # 查看庫

          show databases;

          # mysql的遠程連接

          # 在[mysqld]的段中加上一句:skip-grant-tables

          [mysqld]

          datadir=/var/lib/mysql

          socket=/var/lib/mysql/mysql.sock

          skip-name-resolve

          skip-grant-tables

          目的是為了:

          跳過MySQL的訪問控制,任何人都可以在控制臺以管理員的身份進入MySQL數(shù)據(jù)庫。

          需要注意的是在修改完密碼以后要把MySQL服務(wù)器停掉重新啟動才會生效

          重啟mysql服務(wù)!

          如果你想允許用戶myuser從ip為192.168.1.3的主機連接到mysql服務(wù)器,并使用mypassword作為密碼

          GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

          ############################################################################################

          # 3. 編譯安裝Qt-4.5.2

          ############################################################################################

          ## Qt安裝方法

          解壓安裝包,并移動到 /user/locale/下面.

          ./configure -debug-and-release -fast -qt-sql-mysql -no-qt3support -no-webkit -no-opengl -no-openssl

          # 結(jié)果

          注意:Qt默認只支持PNG圖片,

          如果有JPEG或其它格式,

          需要去Qt的安裝目錄

          pluginsimageformats

          下拷貝圖片插件>

          Debug ............... no

          Qt 3 compatibility .. no

          QtDBus module ....... no

          QtScriptTools module yes

          QtXmlPatterns module yes

          Phonon module ....... no

          SVG module .......... yes

          WebKit module ....... no

          STL support ......... yes

          PCH support ......... yes

          MMX/3DNOW/SSE/SSE2.. yes/yes/yes/yes

          Graphics System ..... default

          IPv6 support ........ yes

          IPv6 ifname support . yes

          getaddrinfo support . yes

          getifaddrs support .. yes

          Accessibility ....... yes

          NIS support ......... yes

          CUPS support ........ no

          Iconv support ....... yes

          Glib support ........ no

          GStreamer support ... no

          Large File support .. yes

          GIF support ......... plugin

          TIFF support ........ plugin (qt)

          JPEG support ........ plugin (qt)

          PNG support ......... yes (qt)

          MNG support ......... plugin (qt)

          zlib support ........ system

          Session management .. yes

          OpenGL support ...... no

          NAS sound support ... no

          XShape support ...... yes

          Xinerama support .... runtime

          Xcursor support ..... runtime

          Xfixes support ...... runtime

          Xrandr support ...... runtime

          Xrender support ..... yes

          Xi support .......... runtime

          MIT-SHM support ..... yes

          FontConfig support .. yes

          XKB Support ......... yes

          immodule support .... yes

          GTK theme support ... no

          MySQL support ....... qt

          SQLite support ...... plugin (qt)

          OpenSSL support ..... no

          ## 編譯安裝

          gmake gmake install

          ## 修改環(huán)境變量

          可以將環(huán)境變量添加到 .bashrc 或 .bash_profile 或 /etc/bashrc 或 /etc/profile

          它們的區(qū)別是:

          1. /etc/profile:對所有用戶生效,當用戶第一次登錄時,該文件被執(zhí)行.

          2. /etc/bashrc:對所有用戶生效,為每一個運行bash shell的用戶執(zhí)行此文件

          3. ~/.bash_profile:僅會對當前用戶有效,當用戶登錄時,該文件僅僅執(zhí)行一次

          4. ~/.bashrc:僅會對當前用戶有效,當?shù)卿洉r以及每次打開新的shell時,該該文件被讀取

          QTDIR=/usr/local/qt-4.5.2

          PATH=$QTDIR/bin:$PATH

          LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

          QMAKESPEC=$QTDIR/mkspecs/linux-g++-64

          export QTDIR

          export PATH

          export LD_LIBRARY_PATH

          export QMAKESPEC

          ## 查看Qt支持的圖片類型

          可以運行下面的函數(shù)查看:QImageReader::supportedImageFormats

          QList QImageReader::supportedImageFormats () [static]

          Returns the list of image formats supported by QImageReader.

          By default, Qt can read the following formats:

          Format Description

          BMP Windows Bitmap

          GIF Graphic Interchange Format (optional)

          JPG Joint Photographic Experts Group

          JPEG Joint Photographic Experts Group

          MNG Multiple-image Network Graphics

          PNG Portable Network Graphics

          PBM Portable Bitmap

          PGM Portable Graymap

          PPM Portable Pixmap

          TIFF Tagged Image File Format

          XBM X11 Bitmap

          XPM X11 Pixmap

          SVG Scalable Vector Graphics

          TGA Targa Image Format

          Reading and writing SVG files is supported through Qt's SVG Module.

          TGA support only extends to reading non-RLE compressed files. In particular calls to capabilities for the tga plugin returns only QImageIOPlugin::CanRead, not QImageIOPlugin::CanWrite.

          To configure Qt with GIF support, pass -qt-gif to the configure script or check the appropriate option in the graphical installer.

          Note that the QApplication instance must be created before this function is called.

          See also setFormat(), QImageWriter::supportedImageFormats(), and QImageIOPlugin.

          ############################################################################################

          # 4. 使用Qt連接Mysql

          ############################################################################################

          #include

          #include

          #include

          #include

          using namespace std;

          int main(int argc, char *argv[])

          {

          QApplication app(argc, argv);

          QSqlDatabase db = QSqlDatabase::addDatabase(QMYSQL);

          db.setHostName(localhost);

          db.setDatabaseName(mydb);

          db.setUserName(username);

          db.setPassword(password);

          db.open();

          QSqlQuery query;

          query.exec(create table hello(id bigint not null auto_increment,name varchar(255),age bigint,primary key (id)));

          query.exec(insert into hello(name, age) values('xiaoxi', 18));

          query.exec(insert into hello(name, age) values('xiaonan', 19));

          query.exec(insert into hello(name, age) values('xiaobei', 20));

          query.exec(insert into hello(name, age) values('xiaodong', 21));

          QSqlQueryModel *model = new QSqlQueryModel;

          model->setQuery(select * from hello);

          model->setHeaderData(0, Qt::Horizontal, id);

          model->setHeaderData(1, Qt::Horizontal, name);

          model->setHeaderData(2, Qt::Horizontal, age);

          QTableView *view = new QTableView;

          view->setWindowTitle(QSqlQueryModel);

          view->setModel(model);

          view->show();

          db.close();

          return app.exec();

          }

          編譯:

          xhy@xhy-desktop:~$ qmake -project

          xhy@xhy-desktop:~$ qmake

          一定別忘了在工程的.pro文件里加上下面一行:

          QT += sql

          xhy@xhy-desktop:~$make

          xhy@xhy-desktop:~$./mysql

          ############################################################################################

          # 5. CentOS配置sftp

          ############################################################################################

          sftp是ssh內(nèi)含的協(xié)議,只要sshd服務(wù)器啟動了,它就可用.

          sftp root@192.168.2.18

          >ls

          >get ...

          >put ...

          如果sshd服務(wù)沒有默認啟動:

          chkconfig sshd on

          ############################################################################################

          # 6. CentOS配置

          ############################################################################################

          # 舉例說明:

          [root@centos6-64 .ssh]# pwd

          /root/.ssh

          [root@centos6-64 .ssh]# ssh-keygen

          Generating public/private rsa key pair.

          Enter file in which to save the key (/root/.ssh/id_rsa):

          Enter passphrase (empty for no passphrase):

          Enter same passphrase again:

          Your identification has been saved in /root/.ssh/id_rsa.

          Your public key has been saved in /root/.ssh/id_rsa.pub.

          The key fingerprint is:

          d6:2a:df:0b:46:3d:22:da:5b:24:b2:da:78:01:f3:c4 root@centos6-64

          The key's randomart image is:

          +--[ RSA 2048]----+

          | |

          | |

          | . |

          | o E o |

          | =. o S + |

          | o= * o . |

          | o.o = |

          | +. * o |

          | o.. . . o. |

          +-----------------+

          [root@centos6-64 .ssh]# ls -lrt

          total 16

          -rw-r--r-- 1 root root 394 Nov 18 16:18 known_hosts

          -rw-r--r-- 1 root root 394 Nov 18 22:32 authorized_keys

          -rw-r--r-- 1 root root 397 Nov 18 22:33 id_rsa.pub

          -rw------- 1 root root 1675 Nov 18 22:33 id_rsa

          [root@centos6-64 .ssh]# scp id_rsa.pub 192.168.2.16:~/.ssh/authorized_keys

          root@192.168.2.16's password:

          id_rsa.pub 100% 397 0.4KB/s 00:00

          [root@centos6-64 .ssh]# ssh 192.168.2.16

          Last login: Mon Nov 18 22:16:16 2013 from 192.168.2.221

          [root@red6-64 ~]#



          關(guān)鍵詞: 無密鑰傳輸 配置

          評論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();