當(dāng)前位置:首頁(yè) > 嵌入式 > 嵌入式軟件
[導(dǎo)讀]這兩天單位要部一個(gè)環(huán)境.CentOS64+Qt+Mysql+ftp+無(wú)密鑰傳輸?shù)?有段日了沒(méi)裝系統(tǒng)了..呵呵..命令忘的都差不多了..記錄一下.###############################################

這兩天單位要部一個(gè)環(huán)境.CentOS64+Qt+Mysql+ftp+無(wú)密鑰傳輸?shù)?

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

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

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

# 1. CentOS 配置yum源

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

# 掛載兩個(gè)ISO

將第一個(gè)盤(pán)的ISO1文件拷貝到ISO2中,進(jìn)行掛載.

[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*

# 啟動(dòng)mysql

service mysqld start

mysql -h192.168.2.18 -uroot -p111

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

netstat -tnlp |grep :3306

# 查看庫(kù)

show databases;

# mysql的遠(yuǎn)程連接

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

[mysqld]

datadir=/var/lib/mysql

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

skip-name-resolve

skip-grant-tables

目的是為了:

跳過(guò)MySQL的訪問(wèn)控制,任何人都可以在控制臺(tái)以管理員的身份進(jìn)入MySQL數(shù)據(jù)庫(kù)。

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

重啟mysql服務(wù)!

如果你想允許用戶myuser從ip為192.168.1.3的主機(jī)連接到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安裝方法

解壓安裝包,并移動(dòng)到 /user/locale/下面.

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

# 配置結(jié)果

<注意:Qt默認(rèn)只支持PNG圖片,

如果有JPEG或其它格式,

需要去Qt的安裝目錄

plugins\imageformats

下拷貝圖片插件>

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:對(duì)所有用戶生效,當(dāng)用戶第一次登錄時(shí),該文件被執(zhí)行.

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

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

4. ~/.bashrc:僅會(huì)對(duì)當(dāng)前用戶有效,當(dāng)?shù)卿洉r(shí)以及每次打開(kāi)新的shell時(shí),該該文件被讀取

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支持的圖片類(lèi)型

可以運(yùn)行下面的函數(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ù)器啟動(dòng)了,它就可用.

sftp root@192.168.2.18

>ls

>get ...

>put ...

如果sshd服務(wù)沒(méi)有默認(rèn)啟動(dòng):

chkconfig sshd on

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

# 6. CentOS配置無(wú)密鑰傳輸

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

# 舉例說(shuō)明:

[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)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專(zhuān)欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

9月2日消息,不造車(chē)的華為或?qū)⒋呱龈蟮莫?dú)角獸公司,隨著阿維塔和賽力斯的入局,華為引望愈發(fā)顯得引人矚目。

關(guān)鍵字: 阿維塔 塞力斯 華為

倫敦2024年8月29日 /美通社/ -- 英國(guó)汽車(chē)技術(shù)公司SODA.Auto推出其旗艦產(chǎn)品SODA V,這是全球首款涵蓋汽車(chē)工程師從創(chuàng)意到認(rèn)證的所有需求的工具,可用于創(chuàng)建軟件定義汽車(chē)。 SODA V工具的開(kāi)發(fā)耗時(shí)1.5...

關(guān)鍵字: 汽車(chē) 人工智能 智能驅(qū)動(dòng) BSP

北京2024年8月28日 /美通社/ -- 越來(lái)越多用戶希望企業(yè)業(yè)務(wù)能7×24不間斷運(yùn)行,同時(shí)企業(yè)卻面臨越來(lái)越多業(yè)務(wù)中斷的風(fēng)險(xiǎn),如企業(yè)系統(tǒng)復(fù)雜性的增加,頻繁的功能更新和發(fā)布等。如何確保業(yè)務(wù)連續(xù)性,提升韌性,成...

關(guān)鍵字: 亞馬遜 解密 控制平面 BSP

8月30日消息,據(jù)媒體報(bào)道,騰訊和網(wǎng)易近期正在縮減他們對(duì)日本游戲市場(chǎng)的投資。

關(guān)鍵字: 騰訊 編碼器 CPU

8月28日消息,今天上午,2024中國(guó)國(guó)際大數(shù)據(jù)產(chǎn)業(yè)博覽會(huì)開(kāi)幕式在貴陽(yáng)舉行,華為董事、質(zhì)量流程IT總裁陶景文發(fā)表了演講。

關(guān)鍵字: 華為 12nm EDA 半導(dǎo)體

8月28日消息,在2024中國(guó)國(guó)際大數(shù)據(jù)產(chǎn)業(yè)博覽會(huì)上,華為常務(wù)董事、華為云CEO張平安發(fā)表演講稱,數(shù)字世界的話語(yǔ)權(quán)最終是由生態(tài)的繁榮決定的。

關(guān)鍵字: 華為 12nm 手機(jī) 衛(wèi)星通信

要點(diǎn): 有效應(yīng)對(duì)環(huán)境變化,經(jīng)營(yíng)業(yè)績(jī)穩(wěn)中有升 落實(shí)提質(zhì)增效舉措,毛利潤(rùn)率延續(xù)升勢(shì) 戰(zhàn)略布局成效顯著,戰(zhàn)新業(yè)務(wù)引領(lǐng)增長(zhǎng) 以科技創(chuàng)新為引領(lǐng),提升企業(yè)核心競(jìng)爭(zhēng)力 堅(jiān)持高質(zhì)量發(fā)展策略,塑強(qiáng)核心競(jìng)爭(zhēng)優(yōu)勢(shì)...

關(guān)鍵字: 通信 BSP 電信運(yùn)營(yíng)商 數(shù)字經(jīng)濟(jì)

北京2024年8月27日 /美通社/ -- 8月21日,由中央廣播電視總臺(tái)與中國(guó)電影電視技術(shù)學(xué)會(huì)聯(lián)合牽頭組建的NVI技術(shù)創(chuàng)新聯(lián)盟在BIRTV2024超高清全產(chǎn)業(yè)鏈發(fā)展研討會(huì)上宣布正式成立。 活動(dòng)現(xiàn)場(chǎng) NVI技術(shù)創(chuàng)新聯(lián)...

關(guān)鍵字: VI 傳輸協(xié)議 音頻 BSP

北京2024年8月27日 /美通社/ -- 在8月23日舉辦的2024年長(zhǎng)三角生態(tài)綠色一體化發(fā)展示范區(qū)聯(lián)合招商會(huì)上,軟通動(dòng)力信息技術(shù)(集團(tuán))股份有限公司(以下簡(jiǎn)稱"軟通動(dòng)力")與長(zhǎng)三角投資(上海)有限...

關(guān)鍵字: BSP 信息技術(shù)
關(guān)閉
關(guān)閉