250716-libreoffice-ubuntu安装后配置环境变量office

优先使用此安装方法

1
2
3
4
5
sudo chmod a+wt /tmp 

sudo apt-get update

sudo apt-get install libreoffice

✅✅✅✅一次搞定,成功!✅✅✅✅

soffice默认安装地址

1
2
3
4
5
6
ubuntu@ubuntu:/usr/local/bin$ pwd
/usr/local/bin

ubuntu@ubuntu:/usr/local/bin$ ls -lh
lrwxrwxrwx 1 root root 36 May 2 18:21 libreoffice24.8 -> /opt/libreoffice24.8/program/soffice
lrwxrwxrwx 1 root root 36 Jun 5 18:45 libreoffice25.2 -> /opt/libreoffice25.2/program/soffice

配置软连接

1
2
3
4
5
sudo ln -s /opt/libreoffice24.8/program/soffice /usr/local/bin/libreoffice
sudo ln -s /opt/libreoffice24.8/program/soffice /usr/local/bin/soffice

sudo ln -s /opt/libreoffice25.2/program/soffice /usr/local/bin/libreoffice
sudo ln -s /opt/libreoffice25.2/program/soffice /usr/local/bin/soffice

现在你可以直接运行:

1
2
libreoffice --writer
libreoffice --calc

检测是否安装成功

1
2
3
which libreoffice

# 应该输出 /usr/local/bin/libreoffice 或 /usr/bin/libreoffice

异常问题解决

/opt/libreoffice25.2/program/oosplash: error while loading shared libraries: libXinerama.so.1: cannot open shared object file: No such file or directory

你当前运行的 LibreOffice 报错的根本原因是系统缺少 libXinerama.so.1 这个共享库。

✅ 解决方法(适用于 Ubuntu / Debian 系统):

请直接运行以下命令安装缺失的依赖:

1
2
sudo apt update
sudo apt install libxinerama1

安装完成后,再次执行:

1
soffice --calc

即可正常启动 LibreOffice 计算器模块。


🔍 补充说明:

  • libxinerama1 是 X11 的一个扩展库,用于支持多显示器环境。
  • 如果你之后还遇到类似错误(如 libcairo.so.2libXrender.so.1 等),可以继续用 apt install 缺失库名 的方式解决。

✅ 总结:

报错内容 原因 解决命令
libXinerama.so.1: cannot open shared object file 缺少依赖库 sudo apt install libxinerama1

异常问题解决

error while loading shared libraries: libssl3.so: cannot open shared object file: No such file or directory

1
2
sudo apt update
sudo apt install libssl3

查找文件位置,并配置环境变量

1
2
3
4
find / -name "libssl.so.3"
/usr/lib/x86_64-linux-gnu/libssl.so.3

find / -name "libssl3.so"

创建软链接

1
2
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.3 /usr/lib/libssl.so.3
sudo ldconfig

【!!&&】LibreOffice 安装引发的血案

1
2
File \"/usr/local/lib/python3.9/site-packages/unstructured/partition/common.py\", line 160, in convert_office_doc\n  
raise FileNotFoundError(\nFileNotFoundError: soffice command was not found. Please install libreoffice\non your system and try again.

fileNotFoundError(\nFileNotFoundError: soffice command was not found. Please install libreoffice\non your system and try
again.

他提示要安装LibreOffice

于是开始了 LibreOffice 的安装 以下链接是安装步骤 ,我选择了然后解压

Linux 下的安装方法 | LibreOffice 简体中文官方网站 - 自由免费的办公套件

解压 采用tar -zxvf /LibreOffice_7.5.4_Linux_x86-64_deb.tar.gz

报错 tar Not found in archive 然后查了查 解决方案

linux ‘tar: not found in archive‘错误处理_超萌养乐多的博客-CSDN博客

采用 了 ls *.tar.gz |xargs -n1 tar -zxvf指令

解压后安装 dpkg -i ./LibreOffice_7.5.4.2_Linux_x86-64_deb/DEBS/*.deb

但是在使用的时候出现了以下错误

1
2
/opt/libreoffice7.5/program/oosplash: error while loading shared libraries: libXinerama.so.1: cannot open shared object
file: No such file or directory

然后去 查找问题 解决方法是安装 libXineramalinux - error while loading shared libraries: libXinerama.so.1: cannot open
shared object file: No such file or directory - Super User

于是开始安装 apt-get install libxinerama1

后面报 Err:5 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libx11-data all 2:1.6.9-2ubuntu1.2 404 Not
Found [IP: 91.189.91.39 80]
Err:6 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libx11-6 amd64 2:1.6.9-2ubuntu1.2 404 Not
Found [IP: 91.189.91.39 80]

于是又查找问题 说要更新

apt-get update

于是开始更新更新有报错GPG error: http://security.ubuntu.com/ubuntu focal-security InRelease: Couldn’t create temporary
file /tmp/apt.conf.HbA52m for passing config to apt-key

于是进行 apt clean ubuntu 16.04 An error occurred during the signature verification. The repository is not updated
and_Hardy-Lee的博客-CSDN博客

1
2
3
4
5
6
sudo apt-get clean  
cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get clean
sudo apt-get update

还是报错

An error occurred during the signature verification. The repository is not updated and the previous index files will be
used. GPG error: http://archive.ubuntu.com/ubuntu focal InRelease: Couldn’t create temporary file /tmp/apt.conf.gmGfhQ
for passing config to apt-key

于是又去 找问题 W: GPG error: http://security.ubuntu.com/ubuntu bionic-security InRelease: Couldn‘t create
temporary_WangJQ*的博客-CSDN博客

于是 给了 权限 chmod a+wt /tmp

apt-get update 可以更新了 apt-get install libxinerama1 也可以安装了

以为可以万事大吉之后

libreoffice7.5 -version
/opt/libreoffice7.5/program/soffice.bin: error while loading shared libraries: libssl3.so: cannot open shared object
file: No such file or directory

然后 找问题 安装了 apt-get install openssl

还是报错然后再安装

apt-get install libssl-dev

然后 沃日 搞不出来

最后我们回顾下 是安装 LibreOffice

于是我找到https://ubuntu.pkgs.org/22.04/libreoffice-amd64/libreoffice_7.5.4~rc2-0ubuntu0.22.04.1~lo1_amd64.deb.html

这个网站然后

1
2
3
4
5
sudo chmod a+wt /tmp 

sudo apt-get update

sudo apt-get install libreoffice

成功了

250715-virtualbox磁盘-ubuntu-lsblk-lvm扩展已有分区(100%)

LVM扩展已有分区

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1. 安装 `cloud-guest-utils`(如果没装):
sudo apt install cloud-guest-utils -y

1. 扩展分区:
sudo growpart /dev/sda 3

1. 扩展物理卷:
sudo pvresize /dev/sda3

1. 扩展逻辑卷:
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

1. 扩展文件系统(假设是 ext4):
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

如何增加/根目录的磁盘空间

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 63.8M 1 loop /snap/core20/2599
loop1 7:1 0 63.3M 1 loop /snap/core20/1828
loop2 7:2 0 91.9M 1 loop /snap/lxd/24061
loop3 7:3 0 91.9M 1 loop /snap/lxd/32662
loop4 7:4 0 50.9M 1 loop /snap/snapd/24718
loop5 7:5 0 49.3M 1 loop /snap/snapd/24792
sda 8:0 0 300G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 48G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 24G 0 lvm /
sr0 11:0 1 1024M 0 rom
sr1 11:1 1 58.6M 0 rom

你现在的情况是:

  • 物理磁盘 /dev/sda 总共 300G
  • 只有 /dev/sda3 这个分区(48G)被用作了 LVM 的物理卷(PV)
  • 根目录 / 挂载在逻辑卷 ubuntu--vg-ubuntu--lv 上,当前只有 24G
  • 你还有 250G 左右的空间没分配(300G - 48G)

✅ 目标:把根目录 / 扩大到整个磁盘(或你想要的大小)


🔧 步骤如下(建议先做快照或备份):

✅ 1. 查看当前 LVM 情况

1
2
3
sudo pvs
sudo vgs
sudo lvs

确认:

  • VG 名称是 ubuntu-vg
  • LV 名称是 ubuntu-lv
  • /dev/sda3 已经是 PV(物理卷)

✅ 2. 将未分区的空间加入 LVM

你有两种选择:


✅ 方法一:扩展已有分区 /dev/sda3(推荐,简单)
  1. 安装 cloud-guest-utils(如果没装):
1
sudo apt install cloud-guest-utils -y
  1. 扩展分区:
1
sudo growpart /dev/sda 3
  1. 扩展物理卷:
1
sudo pvresize /dev/sda3
  1. 扩展逻辑卷:
1
2
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  1. 扩展文件系统(假设是 ext4):
1
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

✅ 方法二:新建分区 /dev/sda4 并加入 LVM(可选)
  1. 创建新分区:
1
2
sudo fdisk /dev/sda
# 新建主分区 /dev/sda4,类型设为 Linux LVM(8e)
  1. 创建 PV:
1
sudo pvcreate /dev/sda4
  1. 扩展 VG:
1
sudo vgextend ubuntu-vg /dev/sda4
  1. 扩展 LV:
1
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  1. 扩展文件系统:
1
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

✅ 最终结果验证

1
df -h /

你应该看到根目录 / 已经变成了 48G 或更大(取决于你扩展到多少)。


⚠️ 注意事项

  • 操作前建议备份重要数据
  • 如果你用的是虚拟机,确保磁盘已经扩容
  • 如果你用的是云主机(如 AWS),确保 EBS 已扩展后再操作

250711-LinuxBox安装Chrome提示:Aw,Snap! Something went wrong while displaying this webpage. Error codeRESULT CODE_INVALID_SANDBOX_STATE

Aw,Snap! Something went wrong while displaying this webpage. Error codeRESULT CODE_INVALID_SANDBOX_STATE

下载链接

google-chrome-stable_current_amd64.deb

提示错误信息

1
2
3
4
5
2025/07/11 11:55:13.705417 cmd_run.go:1344: WARNING: cannot create user data directory: failed to verify SELinux context of /home/ubuntu/snap: exec: "matchpathcon": executable file not found in $PATH
cannot set capabilities: Operation not permitted

chromedriver
cannot set capabilities: Operation not permitted

250706-VirtualBox如何设置1920x1080分辨率

VirtualBox如何设置1920x1080分辨率

https://blog.csdn.net/y1534414425/article/details/129096058

引言
我的电脑屏幕是1920x1080,但是VirtualBox默认的分辨率是小于这个尺寸,导致每次开启虚拟机之后虚拟机的桌面只有我电脑屏幕中间的一部分,两边留黑,所以本文主要是解决这个问题。

操作步骤
VirtualBox默认分辨率是不可以选择的,需要我们手动安装一下增强功能。

首先我们看一下是否有以下的存储介质。

在这里插入图片描述

打开虚拟机,在顶上的菜单栏中选择设备->安装增强功能

在这里插入图片描述

然后在我的电脑中会多一个CD驱动器

在这里插入图片描述

打开之后我们会看到一些文件夹和文件,根据自己的操作系统版本来选择安装哪个,比如我安装的Windows 10 企业版 ltsc
64位操作系统,所以我安装的文件是VBoxWindowsAdditions.exe,如果你是32位操作系统,你就安装-x86结尾的文件。

在这里插入图片描述

安装好之后重启虚拟机就可以选择虚拟机的分辨率了。选择视图->虚拟显示器1

在这里插入图片描述

Windows10 开启远程桌面并添加用户

1.右键我的电脑—-选择属性
2.选择远程设置
3.选中允许远程协助此计算机
4.点击选择用户,如需新建用户的话,点击打开用户账户
5.点击管理其他账户
6.点击添加新用户
7.点击添加一个账户
8.点击用户,添加新用户
9.设置账号名和密码
10.点击创建,创建成功

【WINDOWS10 卸载】安全补丁右键不能卸载处理方法

温馨提示:卸载安全更新可能会带来资讯安全风险,请您衡量风险。)


在更新界面中所有的安全更新没有卸载选项

选取更新的时候左上角应该有可卸载的文字,在安全更新上鼠标左键和右键都没有反应

办法
搜索栏输入【CMD】找到 【命令提示符】,右击【以管理员身份打开】
在【命令提示符】中输入如下命令后回车:
wusa /uninstall /kb:XXXXXXX(补丁编号)
(譬如:wusa /uninstall /kb:5040427) )

1
2
3
4
5
(譬如:wusa /uninstall /kb:5040427) )


wusa /uninstall /kb:5005112

OPC-DA-ALL-List-OPC-(四)-OPC Client Java调用之Utgard

Utgard是什么

官方网站http://openscada.org/projects/utgard/

utgard是一个开源的项目,基于j-interop做的,用于和OPC SERVER通讯。

j-interop是纯java封装的用于COM/DCOM通讯的开源项目,这样就不必使用JNI

Utgard使用

  • 依赖的jar包
j-interop.jar 与COM和DCOM通讯的开源项目
j-interopdeps.jar
jcifs-1.2.19.jar
org.openscada.opc.dcom-1.1.0-20141118.151415-27.jar Utgard dcom的jar包
org.openscada.opc.lib-1.1.0-20141118.151453-1.jar Utgard opc的jar包
slf4j-api-1.7.6.jar Log4j依赖的jar包
log4j-1.2.16.jar Log4j的jar包

Utgard与opc通讯分为两种方式

  • Utgard OPC的API
  • Utgard DCOM的API

示例代码参见

OPC_Client_Utgard项目

关键API示例

  • 列举某Server下的所有OPC连接
1
2
3
4
5
6
7
8
9
10
11
ServerList serverList = new ServerList("10.1.5.123", "freud",
"password", "");

Collection<ClassDetails> classDetails = serverList
.listServersWithDetails(new Category[] {
Categories.OPCDAServer10, Categories.OPCDAServer20,
Categories.OPCDAServer30 }, new Category[] {});

for (ClassDetails cds : classDetails) {
System.out.println(cds.getProgId() + "=" + cds.getDescription());
}
  • 列举连接下的所有Group和Item
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
public static void main(String[] args) throws Exception {
ConnectionInformation ci = new ConnectionInformation();
ci.setHost("10.1.5.123");
ci.setDomain("");
ci.setUser("freud");
ci.setPassword("password");
ci.setClsid("F8582CF2-88FB-11D0-B850-00C0F0104305");

Server server = new Server(ci, Executors.newSingleThreadScheduledExecutor());

server.connect();

dumpTree(server.getTreeBrowser().browse(), 0);
dumpFlat(server.getFlatBrowser());

server.disconnect();
}

private static void dumpFlat(final FlatBrowser browser)
throws IllegalArgumentException, UnknownHostException, JIException {
for (String name : browser.browse()) {
System.out.println(name);
}
}

private static void dumpTree(final Branch branch, final int level) {

for (final Leaf leaf : branch.getLeaves()) {
dumpLeaf(leaf, level);
}
for (final Branch subBranch : branch.getBranches()) {
dumpBranch(subBranch, level);
dumpTree(subBranch, level + 1);
}
}

private static String printTab(int level) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < level; i++) {
sb.append("\t");
}
return sb.toString();
}

private static void dumpLeaf(final Leaf leaf, final int level) {
System.out.println(printTab(level) + "Leaf: " + leaf.getName() + ":"
+ leaf.getItemId());
}

private static void dumpBranch(final Branch branch, final int level) {
System.out.println(printTab(level) + "Branch: " + branch.getName());
}
  • Item的同步查询
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public static void main(String[] args) throws Exception {

ConnectionInformation ci = new ConnectionInformation();
ci.setHost("10.1.5.123");
ci.setDomain("");
ci.setUser("freud");
ci.setPassword("password");
ci.setClsid("F8582CF2-88FB-11D0-B850-00C0F0104305");

Server server = new Server(ci,
Executors.newSingleThreadScheduledExecutor());

server.connect();

Group group = server.addGroup();
Item item = group.addItem("Random.Real5");

Map<String, Item> items = group.addItems("Random.Real1",
"Random.Real2", "Random.Real3", "Random.Real4");

dumpItem(item);

for (Entry<String, Item> temp : items.entrySet()) {
dumpItem(temp.getValue());
}

server.dispose();
}

private static void dumpItem(Item item) throws JIException {
System.out.println("[" + (++count) + "],ItemName:[" + item.getId()
+ "],value:" + item.read(false).getValue());
}

private static int count;
  • Item的异步查询
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
private static final int PERIOD = 100;

private static final int SLEEP = 2000;

public static void main(String[] args) throws Exception {

ConnectionInformation ci = new ConnectionInformation();
ci.setHost("10.1.5.123");
ci.setDomain("");
ci.setUser("freud");
ci.setPassword("password");
ci.setClsid("F8582CF2-88FB-11D0-B850-00C0F0104305");

Server server = new Server(ci,
Executors.newSingleThreadScheduledExecutor());

server.connect();

AccessBase access = new SyncAccess(server, PERIOD);

access.addItem("Random.Real5", new DataCallback() {
private int i;

public void changed(Item item, ItemState itemstate) {
System.out.println("[" + (++i) + "],ItemName:[" + item.getId()
+ "],value:" + itemstate.getValue());
}
});

access.bind();
Thread.sleep(SLEEP);
access.unbind();
server.dispose();
}
  • Item的发布订阅查询
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
private static final int PERIOD = 100;

private static final int SLEEP = 2000;

public static void main(String[] args) throws Exception {

ConnectionInformation ci = new ConnectionInformation();
ci.setHost("10.1.5.123");
ci.setDomain("");
ci.setUser("freud");
ci.setPassword("password");
ci.setClsid("F8582CF2-88FB-11D0-B850-00C0F0104305");

Server server = new Server(ci,
Executors.newSingleThreadScheduledExecutor());

server.connect();

AccessBase access = new Async20Access(server, PERIOD, false);

access.addItem("Random.Real5", new DataCallback() {

private int count;

public void changed(Item item, ItemState itemstate) {
System.out.println("[" + (++count) + "],ItemName:["
+ item.getId() + "],value:" + itemstate.getValue());
}
});

access.bind();
Thread.sleep(SLEEP);
access.unbind();
server.dispose();
}
  • 自动重连Item异步读取
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
private static final int PERIOD = 100;

private static final int SLEEP = 2000;

public static void main(String[] args) throws Exception {

ConnectionInformation ci = new ConnectionInformation();
ci.setHost("10.1.5.123");
ci.setDomain("");
ci.setUser("freud");
ci.setPassword("password");
ci.setClsid("F8582CF2-88FB-11D0-B850-00C0F0104305");

Server server = new Server(ci,
Executors.newSingleThreadScheduledExecutor());

AutoReconnectController controller = new AutoReconnectController(server);

controller.connect();

AccessBase access = new SyncAccess(server, PERIOD);

access.addItem("Random.Real5", new DataCallback() {
private int i;

public void changed(Item item, ItemState itemstate) {
System.out.println("[" + (++i) + "],ItemName:[" + item.getId()
+ "],value:" + itemstate.getValue());
}
});

access.bind();
Thread.sleep(SLEEP);
access.unbind();
controller.disconnect();
}
  • Item同步写入
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
public static void main(String[] args) throws Exception {

ConnectionInformation ci = new ConnectionInformation();
ci.setHost("10.1.5.123");
ci.setDomain("");
ci.setUser("freud");
ci.setPassword("password");
ci.setClsid("F8582CF2-88FB-11D0-B850-00C0F0104305");

Server server = new Server(ci,
Executors.newSingleThreadScheduledExecutor());

server.connect();

Group group = server.addGroup();
Item item = group.addItem("Square Waves.Real4");

final Float[] integerData = new Float[] { 1202f, 1203f, 1204f };
final JIArray array = new JIArray(integerData, false);
final JIVariant value = new JIVariant(array);

item.write(value);
Thread.sleep(2000);

dumpItem(item);

server.dispose();

}

private static void dumpItem(Item item) throws JIException {
System.out.println("[" + (++count) + "],ItemName:[" + item.getId()
+ "],value:" + item.read(true).getValue());
}

private static int count;
  • Item异步写入

OPC-DA-ALL-List-OPC-(三)-OPC主要功能

同步访问

OPC服务器把按照OPC应用程序的要求得到的数据访问结果作为方法的参数返回给OPC应用程序,OPC应用程序在结果被返回为止一直必须处于等待状态。

Synch Read

异步访问

OPC服务器接到OPC应用程序的要求后,几乎立即将方法返回。OPC应用程序随后可以进行其他处理。当OPC服务器完成数据访问时,触发OPC应用程序的异步访问完成事件,将数据访问结果传送给OPC应用程序。OPC应用程序在VB的事件处理程序中接受从OPC服务器传送来的数据。

Asynch Read

订阅方式数据采集

并不需要OPC应用程序向OPC服务器要求,就可以自动接到从OPC服务器送来的变化通知的订阅方式数据采集(Subscription)。服务器按一定的更新周期(UpdateRate)更新OPC服务器的数据缓冲器的数值时,如果发现数值有变化时,就会以数据变化事件(DataChange)通知OPC应用程序。如果OPC服务器支持不敏感带(DeadBand),而且OPC标签的数据类型是模拟量的情况,只有现在值与前次值的差的绝对值超过一定限度时,才更新缓冲器数据并通知OPC应用程序。由此可以无视模拟值的微小变化,从而减轻OPC服务器和OPC应用程序的负荷。

Publish and subscribe

上述的OPC功能可以总结为如下表:

Feature sumary

三种方式的性能总结:

Performance sumary