Linux Centos 7 安裝 Libreoffice 6.2 實(shí)現(xiàn) word ppt excel 轉(zhuǎn)pdf 教程

Linux Centos 7 安裝 Libreoffice 6.2 實(shí)現(xiàn) word ppt excel 轉(zhuǎn)pdf 教程

注: 安裝前建議先執(zhí)行卸載命令: yum remove libreoffice-*

1.安裝[^本文使用的是libreoffice 6.2.8版本]

  • 下載

    采用yum安裝 ;下載rpm包,linux系統(tǒng)一共需要三個(gè)包;

    wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.2.8/rpm/x86_64/LibreOffice_6.2.8_Linux_x86-64_rpm.tar.gz
    wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.2.8/rpm/x86_64/LibreOffice_6.2.8_Linux_x86-64_rpm_sdk.tar.gz
    

wget http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.2.8/rpm/x86_64/LibreOffice_6.2.8_Linux_x86-64_rpm_langpack_zh-CN.tar.gz


>建議使用windows下載好包;上傳服務(wù)器解壓安裝
>
>

~~~linux
直接復(fù)制鏈接下載
http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.2.8/rpm/x86_64/LibreOffice_6.2.8_Linux_x86-64_rpm.tar.gz
http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.2.8/rpm/x86_64/LibreOffice_6.2.8_Linux_x86-64_rpm_sdk.tar.gz
http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.2.8/rpm/x86_64/LibreOffice_6.2.8_Linux_x86-64_rpm_langpack_zh-CN.tar.gz
//如果鏈接失效可以訪問一下鏈接自行選擇版本下載
http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.2.8/rpm/x86_64/

解壓:進(jìn)入包的目錄下執(zhí)行命令:

[root@localhost ~]# tar -xvf xxxxxx.tar.gz -C解壓到指定目錄
  • 安裝

進(jìn)入解壓后的目錄下的RPMS文件夾 執(zhí)行安裝rpm文件 命令 掐隐;yum localinstall *.rpm

[root@localhost LibreOffice_6.2.8.2_Linux_x86-64_rpm]# cd /usr/local/libreoffice/LibreOffice_6.2.8.2_Linux_x86-64_rpm/RPMS/
[root@localhost RPMS]# yum localinstall *.rpm

只演示一個(gè)包的安裝,其他兩個(gè)包的安裝一樣

2.測試Libreoffice[^命令默認(rèn)是libreoffice6.2]

[root@localhost ~]# libreoffice6.2 -help
-bash: libreoffice6.2: command not found

繼續(xù)執(zhí)行一下步驟

3.查看安裝是否成功

[root@localhost ~]# whereis libreoffice6.2 
libreoffice6: /usr/bin/libreoffice6.2

4.啟動(dòng)服務(wù)

[root@localhost ~]#libreoffice6.2 --headless --accept="socket,host=0.0.0.0,port=8100;urp;" --nofirststartwizard

5.查看端口是否啟動(dòng)成功

[root@localhost ~]# ps -ef| grep 8100
root       7399   7265  0 14:21 pts/0    00:00:00 grep --color=auto 8100

### 6.修改命令使用名稱(可選)

[root@localhost ~]# alias libreoffice='libreoffice6.2'
[root@localhost ~]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias libreoffice='libreoffice6.0'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'

7.解決linux Centos 7 下 libreoffice6.2 word excel ppt 轉(zhuǎn)pdf 出現(xiàn) 中文亂碼

命令實(shí)現(xiàn)轉(zhuǎn)換:

[root@localhost ~]# libreoffice6.2 --invisible --convert-to pdf 轉(zhuǎn)換的文件路徑 --outdir 轉(zhuǎn)換后保存的路徑

轉(zhuǎn)換成功后;如果您的Linux系統(tǒng)不支持中文字體刃泡,則會(huì)出現(xiàn)中文亂碼;

    * 解決中文亂碼

查看系統(tǒng)存放字體的目錄:

[root@localhost ~]# cat /etc/fonts/fonts.conf |grep font
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">L
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>
        problems to the fontconfig bugzilla system located at fontconfig.org
        Note that the normal 'make install' procedure for fontconfig is to
        replace any existing fonts.conf file with the new version.  Place
        <dir>/usr/share/fonts</dir>
        <dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir
> <dir>/usr/local/share/fonts</dir>
        <dir prefix="xdg">fonts</dir>
        <dir>~/.fonts</dir>
        <cachedir>/usr/lib/fontconfig/cache</cachedir>
        <cachedir prefix="xdg">fontconfig</cachedir>
        <cachedir>~/.fontconfig</cachedir>
</fontconfig>

上傳 simsun.ttf文件到服務(wù)器碉怔;將文件復(fù)制到/usr/share/fonts下并賦予讀寫權(quán)限;刷新字體緩存

[root@localhost ~]#cp simsun.ttf /usr/share/fonts
[root@localhost ~]# cd /usr/share/fonts/
[root@localhost fonts]#chmod 644 simsun.ttf
[root@localhost fonts]#fc-cache -fv

8.測試Libreoffice

[root@localhost ~]# libreoffice6.2 -help
Warning: -help is deprecated.  Use --help instead.
LibreOffice 6.2.8.2 f82ddfca21ebc1e222a662a32b25c0c9d20169ee

Usage: soffice [argument...]
       argument - switches, switch parameters and document URIs (filenames).

Using without special arguments:
Opens the start center, if it is used without any arguments.
   {file}              Tries to open the file (files) in the components
                       suitable for them.
   {file} {macro:///Library.Module.MacroName}
                       Opens the file and runs specified macros from
                       the file.

Getting help and information:
   --help | -h | -?    Shows this help and quits.
   --helpwriter        Opens built-in or online Help on Writer.
   --helpcalc          Opens built-in or online Help on Calc.
   --helpdraw          Opens built-in or online Help on Draw.
   --helpimpress       Opens built-in or online Help on Impress.
   --helpbase          Opens built-in or online Help on Base.
   --helpbasic         Opens built-in or online Help on Basic scripting
                       language.
   --helpmath          Opens built-in or online Help on Math.
   --version           Shows the version and quits.
   --nstemporarydirectory
                       (MacOS X sandbox only) Returns path of the temporary
                       directory for the current user and exits. Overrides
                       all other arguments.

General arguments:
   --quickstart[=no]   Activates[Deactivates] the Quickstarter service.
   --nolockcheck       Disables check for remote instances using one
                       installation.
   --infilter={filter} Force an input filter type if possible. For example:
                       --infilter="Calc Office Open XML"
                       --infilter="Text (encoded):UTF8,LF,,,"
   --pidfile={file}    Store soffice.bin pid to {file}.
   --display {display} Sets the DISPLAY environment variable on UNIX-like
                       platforms to the value {display} (only supported by a
                       start script).

User/programmatic interface control:
   --nologo            Disables the splash screen at program start.
   --minimized         Starts minimized. The splash screen is not displayed.
   --nodefault         Starts without displaying anything except the splash
                       screen (do not display initial window).
   --invisible         Starts in invisible mode. Neither the start-up logo nor
                       the initial program window will be visible. Application
                       can be controlled, and documents and dialogs can be
                       controlled and opened via the API. Using the parameter,
                       the process can only be ended using the taskmanager
                       (Windows) or the kill command (UNIX-like systems). It
                       cannot be used in conjunction with --quickstart.
   --headless          Starts in "headless mode" which allows using the
                       application without GUI. This special mode can be used
                       when the application is controlled by external clients
                       via the API.
   --norestore         Disables restart and file recovery after a system crash.
   --safe-mode         Starts in a safe mode, i.e. starts temporarily with a
                       fresh user profile and helps to restore a broken
                       configuration.
   --accept={connect-string}  Specifies a UNO connect-string to create a UNO
                       acceptor through which other programs can connect to
                       access the API. Note that API access allows execution
                       of arbitrary commands.
                       The syntax of the {connect-string} is:
                         connection-type,params;protocol-name,params
                       e.g.  pipe,name={some name};urp
                         or  socket,host=localhost,port=54321;urp
   --unaccept={connect-string}  Closes an acceptor that was created with
                       --accept. Use --unaccept=all to close all acceptors.
   --language={lang}   Uses specified language, if language is not selected
                       yet for UI. The lang is a tag of the language in IETF
                       language tag.

Developer arguments:
   --terminate_after_init
                       Exit after initialization complete (no documents loaded).
   --eventtesting      Exit after loading documents.

New document creation arguments:
The arguments create an empty document of specified kind. Only one of them may
be used in one command line. If filenames are specified after an argument,
then it tries to open those files in the specified component.
   --writer            Creates an empty Writer document.
   --calc              Creates an empty Calc document.
   --draw              Creates an empty Draw document.
   --impress           Creates an empty Impress document.
   --base              Creates a new database.
   --global            Creates an empty Writer master (global) document.
   --math              Creates an empty Math document (formula).
   --web               Creates an empty HTML document.

File open arguments:
The arguments define how following filenames are treated. New treatment begins
after the argument and ends at the next argument. The default treatment is to
open documents for editing, and create new documents from document templates.
   -n                  Treats following files as templates for creation of new
                       documents.
   -o                  Opens following files for editing, regardless whether
                       they are templates or not.
   --pt {Printername}  Prints following files to the printer {Printername},
                       after which those files are closed. The splash screen
                       does not appear. If used multiple times, only last
                       {Printername} is effective for all documents of all
                       --pt runs. Also, --printer-name argument of
                       --print-to-file switch interferes with {Printername}.
   -p                  Prints following files to the default printer, after
                       which those files are closed. The splash screen does
                       not appear. If the file name contains spaces, then it
                       must be enclosed in quotation marks.
   --view              Opens following files in viewer mode (read-only).
   --show              Opens and starts the following presentation documents 
                       of each immediately. Files are closed after the showing.
                       Files other than Impress documents are opened in
                       default mode , regardless of previous mode.
   --convert-to OutputFileExtension[:OutputFilterName] \
     [--outdir output_dir] [--convert-images-to]
                       Batch convert files (implies --headless). If --outdir
                       isn't specified, then current working directory is used
                       as output_dir. If --convert-images-to is given, its
                       parameter is taken as the target filter format for *all*
                       images written to the output format. If --convert-to is
                       used more than once, the last value of OutputFileExtension
                       [:OutputFilterName] is effective. If --outdir is used more
                       than once, only its last value is effective. For example:
                   --convert-to pdf *.odt
                   --convert-to epub *.doc
                   --convert-to pdf:writer_pdf_Export --outdir /home/user *.doc
                   --convert-to "html:XHTML Writer File:UTF8" \
                                --convert-images-to "jpg" *.doc
                   --convert-to "txt:Text (encoded):UTF8" *.doc
   --print-to-file [--printer-name printer_name] [--outdir output_dir]
                       Batch print files to file. If --outdir is not specified,
                       then current working directory is used as output_dir.
                       If --printer-name or --outdir used multiple times, only
                       last value of each is effective. Also, {Printername} of
                       --pt switch interferes with --printer-name.
   --cat               Dump text content of the following files to console
                       (implies --headless). Cannot be used with --convert-to.
   --script-cat        Dump text content of any scripts embedded in the files to console
                       (implies --headless). Cannot be used with --convert-to.
   -env:<VAR>[=<VALUE>] Set a bootstrap variable. For example: to set
                       a non-default user profile path:
                       -env:UserInstallation=file:///tmp/test

Ignored switches:
   -psn                Ignored (MacOS X only).
   -Embedding          Ignored (COM+ related; Windows only).
   --nofirststartwizard Does nothing, accepted only for backward compatibility.
   --protector {arg1} {arg2}
                       Used only in unit tests and should have two arguments.

出現(xiàn)詳細(xì)信息則為成功烘贴;

9.啟動(dòng)出錯(cuò)

報(bào)錯(cuò):libreoffice6.2 -help

/opt/libreoffice6.2/program/soffice.bin: error while loading shared libraries: libcairo.so.2: cannot open shared object file: No such file or directory

解決方法:簡書(關(guān)于centos7安裝libreoffice遇到的問題)

報(bào)錯(cuò):libreoffice6.2 -help

/opt/libreoffice6.2/program/soffice.bin: error while loading shared libraries: libcairo.so.2: cannot open shared object file: No such file or directory

解決方法:簡書(關(guān)于centos7安裝libreoffice遇到的問題)

  • 10.測試轉(zhuǎn)換

    libreoffice6.2 invisible --convert-to pdf csDoc.doc[需轉(zhuǎn)換的文件] --outdir /home/upload/linux-libreoffice/pdf/[轉(zhuǎn)出目錄]

    [root@localhost temp]# libreoffice6.2 invisible --convert-to pdf csDoc.doc --outdir /home/upload/linux-libreoffice/pdf/
    /opt/libreoffice6.2/program/soffice.bin: /lib64/libdbus-1.so.3: no version information available (required by /opt/libreoffice6.2/program/libmergedlo.so)
    convert /home/upload/linux-libreoffice/temp/csDoc.doc -> /home/upload/linux-libreoffice/pdf//csDoc.pdf using filter : writer_pdf_Export
    Overwriting: /home/upload/linux-libreoffice/pdf//csDoc.pdf
    [root@localhost temp]# 
    
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市撮胧,隨后出現(xiàn)的幾起案子桨踪,更是在濱河造成了極大的恐慌,老刑警劉巖芹啥,帶你破解...
    沈念sama閱讀 219,427評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件锻离,死亡現(xiàn)場離奇詭異,居然都是意外死亡墓怀,警方通過查閱死者的電腦和手機(jī)汽纠,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,551評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來傀履,“玉大人虱朵,你說我怎么就攤上這事。” “怎么了碴犬?”我有些...
    開封第一講書人閱讀 165,747評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵絮宁,是天一觀的道長。 經(jīng)常有香客問我服协,道長绍昂,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,939評(píng)論 1 295
  • 正文 為了忘掉前任偿荷,我火速辦了婚禮窘游,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘遭顶。我一直安慰自己张峰,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,955評(píng)論 6 392
  • 文/花漫 我一把揭開白布棒旗。 她就那樣靜靜地躺著喘批,像睡著了一般。 火紅的嫁衣襯著肌膚如雪铣揉。 梳的紋絲不亂的頭發(fā)上饶深,一...
    開封第一講書人閱讀 51,737評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音逛拱,去河邊找鬼敌厘。 笑死,一個(gè)胖子當(dāng)著我的面吹牛朽合,可吹牛的內(nèi)容都是我干的俱两。 我是一名探鬼主播,決...
    沈念sama閱讀 40,448評(píng)論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼曹步,長吁一口氣:“原來是場噩夢啊……” “哼宪彩!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起讲婚,我...
    開封第一講書人閱讀 39,352評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤尿孔,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后筹麸,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體活合,經(jīng)...
    沈念sama閱讀 45,834評(píng)論 1 317
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,992評(píng)論 3 338
  • 正文 我和宋清朗相戀三年物赶,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了白指。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,133評(píng)論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡块差,死狀恐怖侵续,靈堂內(nèi)的尸體忽然破棺而出倔丈,到底是詐尸還是另有隱情憨闰,我是刑警寧澤状蜗,帶...
    沈念sama閱讀 35,815評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站鹉动,受9級(jí)特大地震影響轧坎,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜泽示,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,477評(píng)論 3 331
  • 文/蒙蒙 一缸血、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧械筛,春花似錦捎泻、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,022評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至赤赊,卻和暖如春闯狱,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背抛计。 一陣腳步聲響...
    開封第一講書人閱讀 33,147評(píng)論 1 272
  • 我被黑心中介騙來泰國打工哄孤, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人吹截。 一個(gè)月前我還...
    沈念sama閱讀 48,398評(píng)論 3 373
  • 正文 我出身青樓瘦陈,卻偏偏與公主長得像,于是被迫代替她去往敵國和親波俄。 傳聞我的和親對(duì)象是個(gè)殘疾皇子晨逝,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,077評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容