安装本地OpenEuler虚拟机

一、安装OpenEuler虚拟机

1.准备镜像

(1)下载镜像(aarch64的我用不了,只能用x86_64的)

Files.... (openeuler.org)下载前两个文件

安装本地OpenEuler虚拟机

(2)校验完整性

输入以下两条指令,比较输出的结果是否一致(我在wsl Linux中做的)

cat openEuler-20.03-LTS-SP1-aarch64-dvd.iso.sha256sum

sudo sha256sum openEuler-20.03-LTS-SP1-aarch64-dvd.iso

安装本地OpenEuler虚拟机

2.基于Virtualbox安装OpenEuler(简略)

(1)选择版本

选择LinuxOther Linux (64-bit)

安装本地OpenEuler虚拟机

虽然已经校验了iso的完整性,但仍然报了启动盘的错!我晕了。改为下载x86版本。

(2)一些需要点选的东西

换为x86就不报错了,我晕

安装本地OpenEuler虚拟机

安装本地OpenEuler虚拟机

安装本地OpenEuler虚拟机

安装本地OpenEuler虚拟机

安装本地OpenEuler虚拟机

重启后怎么又开始安装了???

安装本地OpenEuler虚拟机

关闭虚拟机,删除盘片

安装本地OpenEuler虚拟机

重启虚拟机,进入

安装本地OpenEuler虚拟机

登录

安装本地OpenEuler虚拟机

二、换源

关机,加一张桥接网卡(个人习惯)

安装本地OpenEuler虚拟机

查看系统

uname -a

我的是x86(因为aarch64失败了,离谱)

安装本地OpenEuler虚拟机

查看原来的源

cd /etc/yum.repos.d/
 
cat openEuler_x64_64.repo

vi打开

vi openEuler_x64_64.repo

粘贴以下内容,注意这里的url要跟你的系统一致

[base]
name=openEuler20.03LTS
baseurl=https://repo.openeuler.org/openEuler-20.03-LTS/everything/x86_64/
enabled=1
gpgcheck=0

再查看一下

cat openEuler_x86_64.repo

安装本地OpenEuler虚拟机

更新源

yum makecache

查看repolist

yum repolist

安装本地OpenEuler虚拟机

查看net-tools包

yum provides net-tools

安装

yum -y install net-tools

然后可以使用ifconfig了

安装本地OpenEuler虚拟机

顺便装个vim

yum install -y vim

安装本地OpenEuler虚拟机

emmmmmm我应该在安装虚拟机之前就给它两张网卡的,这里桥接的网卡没有ip地址...我不会搞了

关闭虚拟机,在Virtualbox中设置网络,NAT网卡的端口转发规则

安装本地OpenEuler虚拟机

然后可以用ssh连接了,泪目

ssh root@127.0.0.1 -p 8888

安装本地OpenEuler虚拟机

三、安装图形化界面UKUI(失败)

我先快了一下照

查看python版本,是2.7,太棒了

安装本地OpenEuler虚拟机

安装字体库

yum groupinstall -y fonts

然后输入下面这条指令

systemctl set-default graphical.target

安装本地OpenEuler虚拟机

然后执行这个

yum install ukui -y

失败了

安装本地OpenEuler虚拟机

四、安装图形化界面UKUI(失败)

这次参考官方文档来做

修改/etc/yum.repos.d/openEuler_x86_64.repo,在文件末尾添加以下内容

[ukui]
name=ukui
baseurl= http://openkylin.com/repo/ukui/x86_64/
enabled=1
gpgcheck=0
priority=1

安装本地OpenEuler虚拟机

yum makecache

运行以下命令

cd /root/
wget http://openkylin.com/repo/ukui/x86_64/install_online.sh
wget http://openkylin.com/repo/ukui/x86_64/reinstall.zip  
unzip reinstall.zip
chmod a+x install_online.sh
./install_online.sh

结果第二条就因为连不上而失败了,遂放弃

五、安装图形化界面UKUI(失败)

这次参考官方文档的离线安装方法

安装createrepo

yum install createrepo

安装本地OpenEuler虚拟机

后来把源里上一步添加的[ukui]的部分删掉,更新源,重新试试

安装本地OpenEuler虚拟机

果然是这破源的问题

然后百度网盘下载必须的文件

链接:https://pan.baidu.com/s/1BDUyj5pRssqMOlZ7mfLh7Q 
提取码:b9o0

emmm然后为了把文件传进openEuler虚拟机,我尝试把这些文件上传到码云上,然后在虚拟机里装个git

yum install git

安装本地OpenEuler虚拟机

然后git clone下来

git clone https://gitee.com/realyutian/information-system-design-1218.git
mv information-system-design-1218/x86_64/ .

(快个照)

然后把reinstall.zipinstall.sh放到/root目录下,在/目录下新建文件夹RPMS,并将下载的整个RPMS文件夹的内容放入/RPMS目录下

cd x86_64/
cp install.sh /root
cp reinstall.zip /root
cd /
mkdir RPM
cp /root/x86_64/RPMS/* ./RPM

然后改源/etc/yum.repos.d/openEuler_x86_64.repo,把那破[ukui]源再给弄进去

[ukui]
name=ukui
baseurl=file:///RPMS/
enabled=1
gpgcheck=0
priority=1

切换到root目录,以root用户执行以下指令

cd /root/
createrepo ./../RPMS
unzip reinstall.zip
chmod a+x install.sh
./install.sh

.....报了一堆错

安装本地OpenEuler虚拟机

我把那破源再删掉试试

报了一堆其他错

安装本地OpenEuler虚拟机

恢复快照

六、安装openssl

查看原本的版本

安装本地OpenEuler虚拟机

下载1.1.1k版本

wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz

/root处建俩文件夹,分别放OpenSSL的源码和安装路径

mkdir yutianopensslsrc yutianopenssl

安装本地OpenEuler虚拟机

解压源代码到yutianopensslsrc路径

tar -zxvf openssl-1.1.1k.tar.gz -C yutianopensslsrc

发现没有tar,然后yum安装又是0速,于是改一下源,把之前添加的ukui源给删掉并更新了源

安装本地OpenEuler虚拟机

然后可以安装tar了yum install -y tar,然后用tar执行上面的解压指令

配置编译安装路径/root/yutianopenssl

cd yutianopensslsrc/openssl-1.1.1k/
./config --prefix=/root/yutianopenssl

安装本地OpenEuler虚拟机

编译(很慢)

make
make test
make install

查看安装后的版本

cd ~/yutianopenssl
./bin/openssl version

安装本地OpenEuler虚拟机

编译几个代码试试(代码来自《精通PKI网络安全认证技术与编程实现》,书中给的代码需要去掉windows.h,以及在两个ctx的定义之前加上*)

注意使用vi而不是vim,vim因为自己的一些高级配置,导致粘贴进去的代码反而格式会出错

#include <stdio.h>
#include <string.h>
#include <openssl/evp.h>
#include <openssl/x509.h>

//Base64编码
void tEVP_Encode()
{
	EVP_ENCODE_CTX *ctx;				//EVP编码结构体
	unsigned char in[1024];			//输入数据缓冲区
	int inl;						//输入数据长度
	char out[2048]={0};				//输出数据缓冲区
	int outl;						//输出数据长度
	FILE *infp;						//输入文件句柄
	FILE *outfp;					//输出文件句柄

	infp = fopen("test.dat","rb");//打开待编码的文件
	if(infp == NULL)
	{
		printf("Open File "Test.dat"  for Read Err.
");
		return;
	}
	
	outfp = fopen("test.txt","w");//打开编码后保存的文件
	if(outfp == NULL)
	{
		printf("Open File "test.txt" For Write Err.
");
		return;
	}
	EVP_EncodeInit(&ctx);//Base64编码初始化
	printf("文件"Test.dat" Base64编码后为:
");
	//循环读取原文,并调用EVP_EncodeUpdate计算Base64编码
	while(1)
	{
		inl = fread(in,1,1024,infp);
		if(inl <= 0)
			break;
		EVP_EncodeUpdate(&ctx,out,&outl,in,inl);//编码
		fwrite(out,1,outl,outfp);//输出编码结果到文件
		printf("%s",out);
	} 
	EVP_EncodeFinal(&ctx,out,&outl);//完成编码,输出最后的数据。
	fwrite(out,1,outl,outfp);
	printf("%s",out);
	fclose(infp);
	fclose(outfp);	
	printf("对文件"Test.dat" Base64编码完成,保存到"test.txt"文件.


");
}

//Base64解码
void tEVP_Decode()
{
	EVP_ENCODE_CTX *ctx;				//EVP编码结构体
	char in[1024];					//输入数据缓冲区
	int inl;						//输入数据长度
	unsigned char out[1024];		//输出数据缓冲区
	int outl;						//输出数据长度
	FILE *infp;						//输入文件句柄
	FILE *outfp;					//输出文件句柄
	
	infp = fopen("test.txt","r");//打开待解码的文件
	if(infp == NULL)
	{
		printf("Open File "Test.txt"  for Read Err.
");
		return;
	}
	outfp = fopen("test-1.dat","wb");//打开解码后保存的文件
	if(outfp == NULL)
	{
		printf("Open File "test-1.txt" For Write Err.
");
		return;
	}
	EVP_DecodeInit(&ctx);//Base64解码初始化
	printf("开始对文件"Test.txt" Base64解码...

");
	//循环读取原文,并调用EVP_DecodeUpdate进行Base64解码
	while(1)
	{
		inl = fread(in,1,1024,infp);
		if(inl <= 0)
			break;
		EVP_DecodeUpdate(&ctx,out,&outl,in,inl);//Base64解码
		fwrite(out,1,outl,outfp);//输出到文件
	} 
	EVP_DecodeFinal(&ctx,out,&outl);//完成解码,输出最后的数据。
	fwrite(out,1,outl,outfp);
	fclose(infp);
	fclose(outfp);	
	printf("对文件"Test.txt" Base64解码完成,保存为"test-1.dat"


");
	
}
 
int main()
{
 
	tEVP_Encode();
	tEVP_Decode();
	
	return 0;
}

编译

gcc -o testbase64 main.c -I /root/yutianopenssl/include -L /root/yutianopenssl/lib -lcrypto -lpthread -finput-charset=GBK -fexec-charset=UTF-8

报错了,我后悔选择安装了中文,这报错信息根本百度不到,英文的话大概是fatal error一类的吧

安装本地OpenEuler虚拟机

重新编译

gcc -o testbase64 main.c -I /root/yutianopenssl/include -L /root/yutianopenssl/lib -lcrypto -lpthread

安装本地OpenEuler虚拟机

这里需要用到一个二进制文件test.dat

我在windows中用010editor打开书提供的这个文件

然后File→Export Hex导出16进制文本

安装本地OpenEuler虚拟机

在openEuler中用vim新建文件test.dat

切换为16进制

:%!xxd

粘贴之前导出的16进制文本

34 12 01 00 D8 91 B9 87 20 3E DF 43 BE 98 5C 97
EC CE D2 62 E9 F0 33 AE BB CC 00 00 00 00 00 00
CA CD 00 00 28 92 3F DD FE DD 33 A7 01 00 00 00
CB CD 00 00 C5 57 AE 64 15 5D A9 C8 01 00 00 00
CC CD 00 00 0D 5E 77 70 F8 DD 9B 58 01 00 00 00
CD CD 00 00 7B 31 6C 6E 5B 6C 1E DE 01 00 00 00
CE CD 00 00 73 7E 7C 05 F8 2B F0 15 01 00 00 00

然后变回去,保存退出

:%!xxd -r
:wq

安装本地OpenEuler虚拟机

执行编译生成的testbase64

安装本地OpenEuler虚拟机

怎么又报错了啊我傻了

重新改一下main.c

#include <stdio.h>
#include <string.h>
#include <openssl/evp.h>
#include <openssl/x509.h>

//Base64编码
void tEVP_Encode()
{
	EVP_ENCODE_CTX *ctx;
        ctx = EVP_ENCODE_CTX_new();	//EVP编码结构体
	unsigned char in[1024];			//输入数据缓冲区
	int inl;						//输入数据长度
	char out[2048]={0};				//输出数据缓冲区
	int outl;						//输出数据长度
	FILE *infp;						//输入文件句柄
	FILE *outfp;					//输出文件句柄

	infp = fopen("test.dat","rb");//打开待编码的文件
	if(infp == NULL)
	{
		printf("Open File "Test.dat"  for Read Err.
");
		return;
	}
	
	outfp = fopen("test.txt","w");//打开编码后保存的文件
	if(outfp == NULL)
	{
		printf("Open File "test.txt" For Write Err.
");
		return;
	}
	EVP_EncodeInit(ctx);//Base64编码初始化
	printf("文件"Test.dat" Base64编码后为:
");
	//循环读取原文,并调用EVP_EncodeUpdate计算Base64编码
	while(1)
	{
		inl = fread(in,1,1024,infp);
		if(inl <= 0)
			break;
		EVP_EncodeUpdate(ctx,out,&outl,in,inl);//编码
		fwrite(out,1,outl,outfp);//输出编码结果到文件
		printf("%s",out);
	} 
	EVP_EncodeFinal(ctx,out,&outl);//完成编码,输出最后的数据。
	fwrite(out,1,outl,outfp);
	printf("%s",out);
	fclose(infp);
	fclose(outfp);	
	printf("对文件"Test.dat" Base64编码完成,保存到"test.txt"文件.


");
}

//Base64解码
void tEVP_Decode()
{
	EVP_ENCODE_CTX *ctx;
        ctx = EVP_ENCODE_CTX_new();			//EVP编码结构体
	char in[1024];					//输入数据缓冲区
	int inl;						//输入数据长度
	unsigned char out[1024];		//输出数据缓冲区
	int outl;						//输出数据长度
	FILE *infp;						//输入文件句柄
	FILE *outfp;					//输出文件句柄
	
	infp = fopen("test.txt","r");//打开待解码的文件
	if(infp == NULL)
	{
		printf("Open File "Test.txt"  for Read Err.
");
		return;
	}
	outfp = fopen("test-1.dat","wb");//打开解码后保存的文件
	if(outfp == NULL)
	{
		printf("Open File "test-1.txt" For Write Err.
");
		return;
	}
	EVP_DecodeInit(ctx);//Base64解码初始化
	printf("开始对文件"Test.txt" Base64解码...

");
	//循环读取原文,并调用EVP_DecodeUpdate进行Base64解码
	while(1)
	{
		inl = fread(in,1,1024,infp);
		if(inl <= 0)
			break;
		EVP_DecodeUpdate(ctx,out,&outl,in,inl);//Base64解码
		fwrite(out,1,outl,outfp);//输出到文件
	} 
	EVP_DecodeFinal(ctx,out,&outl);//完成解码,输出最后的数据。
	fwrite(out,1,outl,outfp);
	fclose(infp);
	fclose(outfp);	
	printf("对文件"Test.txt" Base64解码完成,保存为"test-1.dat"


");
	
}
 
int main()
{
 
	tEVP_Encode();
	tEVP_Decode();
	
	return 0;
}

编译

gcc -o testbase64 main.c -I /root/yutianopenssl/include -L /root/yutianopenssl/lib -lcrypto -lpthread

运行

./testbase64

安装本地OpenEuler虚拟机emmmmm好像我生成test.dat的方法还是不对不过这次代码好歹能运行了

第一次的代码是我根据书改的,第二次是老师的博客里提供的,我重新写一个文件main2.c存第一次的代码,用diff比较一下文件差异

diff main.c main2.c

安装本地OpenEuler虚拟机

所以差异就是要把ctx之前的&给去掉

七、安装图形化界面GNOME(失败)

记得快照

yum install gnome-shell gdm gnome-session gnome-terminal -y
systemctl enable gdm.service                  //设置gdm自启
systemctl set-default graphical.target        //修改启动级别为图形化
wget https://zycxzx.obs.cn-east-3.myhuaweicloud.com/Xsession
mv Xsession /etc/gdm/
chmod -R 777 /etc/gdm/Xsession               //这个操作的原因是openEuler源里的gdm文件Xsession有问题,从网上下一个替换即可,否则图形化无法正常登录

额,报错了

安装本地OpenEuler虚拟机

重启一下试试,果然无法登录,输入密码后会跳回来(啊这

安装本地OpenEuler虚拟机

恢复之前的快照

八、安装图形化界面GNOME

换源(第一条根据自己的系统修改,我是x86)

wget -O /etc/yum.repos.d/openEuler_x86_64.repo https://repo.huaweicloud.com/repository/conf/openeuler_x86_64.repo

yum clean all

yum makecache

安装本地OpenEuler虚拟机

yum install gnome-shell gdm gnome-session gnome-terminal -y
systemctl enable gdm.service                  //设置gdm自启
systemctl set-default graphical.target        //修改启动级别为图形化

安装本地OpenEuler虚拟机

wget https://zycxzx.obs.cn-east-3.myhuaweicloud.com/Xsession
mv Xsession /etc/gdm/
chmod -R 777 /etc/gdm/Xsession               //这个操作的原因是openEuler源里的gdm文件Xsession有问题,从网上下一个替换即可,否则图形化无法正常登录

安装本地OpenEuler虚拟机

重启一下

安装本地OpenEuler虚拟机

NB

终于可以开启我的桥接网卡了

安装本地OpenEuler虚拟机

先快个照

九、安装增强功能

点击安装增强功能结果

安装本地OpenEuler虚拟机

先关机

安装本地OpenEuler虚拟机

迷惑行为,而且你再点一下关机的话它又会重置这60s

结果倒计时结束了也关不掉,于是我强制退出

尝试添加虚拟光驱

安装本地OpenEuler虚拟机

安装本地OpenEuler虚拟机

启动虚拟机,安装增强功能

安装本地OpenEuler虚拟机

先弹出

安装本地OpenEuler虚拟机

再点一次安装增强功能

cd /run/media/yutian1218/VBox_GAs_6.1.18/
./VBoxLinuxAdditions.run

安装本地OpenEuler虚拟机

又失败了

参考

为 openEuler 安装 桌面环境图形化界面【ukui】_m0_51378263的博客-CSDN博客_openeuler安装图形界面

UKUI for openEuler released!

openEuler虚拟机配置yum源_想练武,就得下功夫-CSDN博客

openEuler_UKUI_install_cn.md · openKylin/ukui-issues - Gitee.com

openEuler_UKUI_offline_install_cn.md · openKylin/ukui-issues - Gitee.com

[日常] 为OpenEuler安装图形界面_A land whole of flowers.-CSDN博客_openeuler安装图形界面

openeuler 20.03 安装图形化界面_鲲鹏论坛_华为云论坛 (huaweicloud.com)