CentOS 64+Qt+Mysql+ftp+鍵なし伝送の構成


この2,3日単位は1つの環境を必要とする.CentOS 64+Qt+Mysql+ftp+鍵なしで伝送する.しばらくシステムをインストールしていません..命令の忘れ物は多くない..
############################################################################################ # 1. CentOS構成yumソース
#2個のISOをマウント最初のディスクのISO 1ファイルをISO 2にコピーしてマウントする.
        
  /etc/fstab
tmpfs                   /dev/shm                tmpfs   defaults         0 0
devpts                  /dev/pts                devpts  gid=5,mode=620   0 0
sysfs                   /sys                    sysfs   defaults         0 0
proc                    /proc                   proc    defaults         0 0
/root/centos64.iso      /mnt/iso                iso9660 defaults,ro,loop 0 0

mkdir /mnt/iso
      
mount -o loop -t iso9660 /root/centos64.iso /mnt/iso

変更/etc/yum.repos.d/cetnos.repo [base-centos] name=CentOS baseurl=file:///mnt/iso gpgcheck=0 enabled=1
#gcc,java yum intall-y gcc*yum intall-y java*をインストール
#ファイアウォールを閉じる閉じる閉じる閉じる閉じる:chkconfig iptables off selinuxenabled 0
 
############################################################################################ # 2. MYSQL-5.1.66をインストール
 
#yumソースを構成したら、yum install-y mysql*
#mysql service mysqld start mysql-h 192を起動します.168.2.18 -uroot -p111
#リスニングポートnetstat-tnlp|grep:3306の表示
#ライブラリshow databasesを表示する;
#mysqlのリモート接続#skip-grant-tables[mysqld]datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock  skip-name-resolve  skip-grant-tables
目的は、MySQLのアクセス制御をスキップし、誰もがコンソールで管理者としてMySQLデータベースにアクセスできるようにすることです.パスワードを変更した後、MySQLサーバーを停止して再起動しなければmysqlサービスを再起動できないことに注意してください.
ユーザーmyuserがip 192.168.1.3のホストからmysqlサーバに接続し、mypasswordをパスワードとして使用することを許可したい場合は、GRANT ALL PRIVILEGESE*.*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
#構成結果<注意: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
##環境変数を修正する環境変数を追加することができる.bashrcまたは.bash_profileまたは/etc/bashrcまたは/etc/profileの違いは、1.etc/profile:すべてのユーザに対して有効であり、ユーザが初めてログインすると、このファイルが実行される.2./etc/bashrc:bash shellを実行する各ユーザに対して、すべてのユーザに対して有効となる.bash_profile:現在のユーザに対してのみ有効である、ユーザがログインすると、そのファイルは1回のみ4.~/を実行する.bashrc:現在のユーザーにのみ有効で、ログイン時および新しい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でサポートされているピクチャタイプを表示するには、QImageReader::supportedImageFormat
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に含まれるプロトコルで、sshdサーバが起動すれば使用できます.sftp [email protected] >ls >get ... >put ...
sshdサービスがデフォルトで起動していない場合: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-copy-id 192.168.2.16 [email protected]'s password: Now try logging into the machine, with "ssh '192.168.2.16'", and check in:
  .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
<成功>
[root@centos6-64 ~]# ssh 192.168.2.16 Last login: Mon Nov 25 10:10:24 2013 from 192.168.2.166 [root@www ~]#